Ya arkadaşlar kafayı yiycem, bi siteye curl ile veri post edip yanıt almaya çalışıyorum ancak ne denediysem hiçbir şekilde yanıt gelmiyor sayfa hep boş geliyor sizce ne eksik olabilir giden veriyi base64 le kodlayıp da denedim herşeyi denedim yine olmadı, bu arada curl hata felan vermiyo post işlemi başarılı gidiyor sadece boş sayfa geliyor...
CURL ile veri post işlemine başlamadan önce gelen header aşağıdaki gibidir;
HTTP/1.1 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Thu, 19 Nov 1981 08:52:00 GMT Server: Microsoft-IIS/7.5 Set-Cookie: PHPSESSID=e144849dd7d30c8f74f880b03c1ed48f; path=/ X-Powered-By: ASP.NET X-Powered-By-Plesk: PleskWin Date: Tue, 26 Aug 2014 05:53:04 GMT Connection: close Content-Length: 0
NOT: Browser'a captcha kodunu tanımak için "phpsessid" adlı bir çerez kaydetmeye çalışıyor, önce onu değişkene alıp 2. bir curl ile(aşağıdaki php kodundaki gibi CURLOPT_COOKIE ile) veriyi post ediyorum yani herşey tamam tek sorun yanıt gelmemesi.
Çalıştırdığım php kodları aşağıdaki gibidir:
$PHPSESSID=""; o anki session ID
$url="www.xxxxxxx.com/ara.php "; // veri post edilecek url
$veri=""; //sorgulancak numara
$captcha=""; //o anki girilecek captcha kodu
$fields = array(
'no' => urlencode($veri),
'security' => urlencode($captcha),
'islem' => urlencode("sorgula")
);
$fields_string="";
$nfields=count($fields);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//echo $fields_string;
//Load user's PHPSESSID data to CURL
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST,$nfields);
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt ($ch, CURLOPT_COOKIE, "PHPSESSID=$PHPSESSID;");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);// return web page
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)');
$result = curl_exec ($ch);
echo $result; // gelen sonuç
Veri post edildikten sonra gelen header aşağıdaki gibidir gördüğünüz gibi content length: 0...;
HTTP/1.1 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Thu, 19 Nov 1981 08:52:00 GMT Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET X-Powered-By-Plesk: PleskWin Date: Tue, 26 Aug 2014 06:02:44 GMT Connection: close Content-Length: 0