Curl İle json post
4
●1.020
- 03-11-2012, 22:05:53Üyeliği durdurulduKaynak kodlarım bunlar karşıdaki php dosyasından veri alamıyorum. Nerede ne gibi düzeltme yapmam gerekiyor ? Yardımcı olursan sevinirim.
$ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt'); $postfields = array("cmd"=>$cmd,"parent"=>$parent,"key"=>$key); $data_string = json_encode($postfields); curl_setopt($ch, CURLOPT_URL, "http://site.com/post.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $data = curl_exec($ch);
var params={ cmd : 'blist', parent : 12189, key : '70ee439586c0615b5bb4ffe47eadb469' }; $.post('post.php',params,function(json) { if(json.success) { $('#yaz').html(json.results); } else { alert(json.messages); } }, 'json'); - 03-11-2012, 23:01:00Üyeliği durduruldubu şekil dene
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);