v2.5.2
Giriş yap

Localhost Üzerinde Çalışan cURL İşleminin Sunucuda Çalışmaması

kaskan
712 defa görüntülendi

Merhaba arkadaşlar, cURL ile web sitesinden veri çekmeye çalışıyorum, localhost üzerinden sorunsuz çekiyor ama sunucuda çekmek istediğimde boş değer dönüyor.
Kullanıdğım fonksiyon budur;

function curlKullan($url){
	$curl = curl_init();
	curl_setopt($curl,CURLOPT_REFERER,'http://google.com');
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);     // return web page
    curl_setopt($curl, CURLOPT_HEADER,true);     //return headers in addition to content
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION,true);     // follow redirects
    curl_setopt($curl, CURLOPT_ENCODING,"utf-8");       // handle all encodings
    curl_setopt($curl, CURLOPT_AUTOREFERER,true);    // set referer on redirect
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT,120);      // timeout on connect
    curl_setopt($curl, CURLOPT_MAXREDIRS,10);       // stop after 10 redirects
    curl_setopt($curl, CURLINFO_HEADER_OUT,true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,false);    // Disabled SSL Cert checks
    curl_setopt($curl, CURLOPT_POST,0);
	curl_setopt($curl,CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);	
	$cikti = curl_exec($curl);
	curl_close($curl);
	$cikti = str_replace(array("n","t","r"), null, $cikti);
	return $cikti;
}
$url = curlKullan('https://www.cctvcalculator.net/api/calculation.php?jsoncallback=jQuery214038336959030315054_1585735346782&calc=storage&security=a9f5523fe5&motion=1.00&resolution=640-360&codec=340&cameras=1&mfps=1&nfps=10&days=1');
print_r($url);

//Localhostta 
//HTTP/2 200 server: nginxdate: Thu, 02 Apr 2020 07:10:00 GMTcontent-type: application/x-javascriptexpires: Thu, 19 Nov 1981 08:52:00 GMTcache-control: no-store, no-cache, must-revalidatepragma: no-cacheset-cookie: PHPSESSID=k69ofnpfvjchntlpggm4hinh8v; path=/jQuery214038336959030315054_1585735346782({"storage":22.1})

//Sunucuda
//HTTP/2 200 server: nginxdate: Thu, 02 Apr 2020 07:11:12 GMTcontent-type: text/htmlcontent-length: 0expires: Thu, 19 Nov 1981 08:52:00 GMTcache-control: no-store, no-cache, must-revalidatepragma: no-cacheset-cookie: PHPSESSID=egtkg2l7vd790fo5c59crqm79a; path=/
mutluol
1494 gün önce

libcurl paketinin olup olmadığına bak