Curl Hata Nerede ?
-
Sürekli kullandığım curl fonksiyonu ile post işlemi yaptım, sitede post işlemi aynı sayfaya yapıyor ve sonuç geliyor ama sayfanın tümü geliyor, preg_match_all ile normalde yaptığım gibi ayrıştırıyorum fakat çalışmıyor, title bile gelmiyor sayfa komple geliyor, baya bi uğraştım ama sonuç nafile, acaba hatam nerede.
$crl = curl_init(); curl_setopt($crl, CURLOPT_URL, "http://www.postedileceksite.net"); curl_setopt($crl, CURLOPT_POST, 1); curl_setopt($crl, CURLOPT_POSTFIELDS,"kullanici=".$nick.""); curl_setopt($crl, CURLOPT_REFERER,"http://www.postedileceksite.net"); curl_setopt($crl, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']); curl_exec($crl); curl_close($crl); $data=curl_exec($crl); $parcala ="<div id=\"blog\">(.*?)<\/div>"; preg_match_all('#'.$parcala.'#' ,$data , $sonuc); echo $sonuc[1][0]; -
php bilmem hocam ama şöyle bi örnek var
<<?php // // A very simple PHP example that sends a HTTP POST to a remote site // $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://www.mysite.com/tester.phtml"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "postvar1=value1&postvar2=value2&postvar3=value3"); // in real life you should use something like: // curl_setopt($ch, CURLOPT_POSTFIELDS, // http_build_query(array('postvar1' => 'value1'))); // receive server response ... curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec ($ch); curl_close ($ch); // further processing .... if ($server_output == "OK") { ... } else { ... } ?>mesela bu login için örnek. orada dikkatimi çeken returntransfer kısmı. burası serverdan cvp alıyor v.s.
buradan isteğin türde curl örnekleri var http://curl.haxx.se/libcurl/php/examples/
bir de post falan atarken fiddler ile takip edebilirsin
-
Problem çözülmüştür.
Toplam Hit: 691 Toplam Mesaj: 3
