Curl İle Authorization Headeri Okuyamiyorum
-
Su internet sayfasini fidler sniffer yaptigimda su asagidaki resimdeki bilgiler görünüyor.
Fakat bu bilgileri curl ile almaya kalktugimda bir türlü resmin'de görünen kismi alamiyorum.
Resimde sandigim kadari ile
http://deneme.com/soliddata.php sayfasina POST edilen satir
Basic U29saWRTdHJlYW254754875WRTdHJlYW16IUA= bu satiri POST ediyorum(useraneme ve password) ama sonucda HTTP/1.1 200 OK aliyorum ama yukardak Resimin asagi kisminda görünen satiri alamiyorum.
Fiddler gösteriyor ama ben alamiyorum.
kullandigim curl funktionu kodu:
function site_kaynak($url,$username,$password) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password); curl_setopt($ch, CURLOPT_SSLVERSION,3); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $result = curl_exec($ch); curl_close($ch); return $result; }
nerde yanlis yapiyorum?
-
http://solidstreamz.com/soliddata.php
bu sayfa curl ile okunamaz.
-
-
YekteranBaymedir bunu yazdı
doyucu dan güzel lezzetli bir post olmuş Teşekkürler. bende CURL'u biziklıyordum şansa. Çok farklı bir noktada LibCUrl çok iş çözecek bana :)
-
@YekteranBaymedir hocam gercekten güzel aciklamsiisn özellikle resim üzerinde anlatimin cok yarayici.
fakat ben belirttigin optionu kaldirdim ama yine BODY'deki bilgiyi alamiyorum.
aldigim satir söyle
HTTP/1.1 200 OK Date: Wed, 28 Dec 2016 13:58:54 GMT Server: Apache X-Powered-By: PHP/5.6.28 Content-Length: 0 Content-Type: text/html; charset=UTF-8
function site_kaynak($url,$username,$password) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password);
curl_setopt($ch, CURLOPT_HEADER, true);
$result = curl_exec($ch);
curl_close($ch);
//return $result;
} -
Hocam @YekteranBaymedir ayrıntılı şekilde anlatmış zaten. Sadece NOBODY option'unu kaldırınca çalışıyor. Buyur;
<?php
$username = "SolidStreamz";
$password = "****"; // Burayı şifreyle değiştir
$host = "http://solidstreamz.com/soliddata.php";
$process = curl_init($host);
curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded','Host: solidstreamz.com','User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14'));
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC) ;
curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, []);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($process);
curl_close($process);
echo $return;
-
Android Live TV ha?
-
sagol dostum ikinci örnektede
curl_setopt($process, CURLOPT_POST, 1); satirini koymamisim.
Cok tesekkürler her ikinizede.
-
PostMan'i kullanamaya başladım hocam bu tarz işlerde direk kod vermesi cok işlevsel oluyor.
http://i.hizliresim.com/9gmngk.png