2017-02-28 57 views
0

我想通過cUrl作者:文件內容(沒有的file_get_contents功能),但我不能,捲曲打開它捲曲會無法訪問文件,但瀏覽器

我的鏈接是here

我測試了我與requestb.in託管和結果

$header = array(); 
$header[] = 'Accept-Encoding: gzip'; 
$header[] = 'Connection: close'; 
$header[] = 'Host: panel.1n3k.com'; 
$header[] = 'User-Agent: runscope-radar/2.0'; 
$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_VERBOSE, 1); 
curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); 
$response = curl_exec($ch); 
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); 
$header = substr($response, 0, $header_size); 
$body = substr($response, $header_size); 
curl_close($ch); 

我試圖與代理CURLOPT_USERAGENT與我的瀏覽器的代理。

CURLOPT_REFERERCURLOPT_ENCODINGCURLOPT_AUTOREFERER

一個接一個,但沒有人能幫助我...

這可怎麼更多鈔票?

+0

不可能告訴沒有更多的信息,可能是一個服務器端重定向,JavaScript等 – jeroen

+0

我使用panel.1n3k.com htaccess的但我可以通過瀏覽器訪問? – ahmetertem

回答

0

嘗試這一個來查看您的鏈接的圖像內容

<?php 
header("Content-Type: image/jpeg"); 

$url = 'http://panel.1n3k.com/6512bd43d9caa6e02c990b0a82652dca/api/media/4/logo/831710_1464331440.png'; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_HEADER, false); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.1 Safari/537.11'); 
$res = curl_exec($ch); 
$rescode = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
curl_close($ch) ; 
echo $res; 
?> 
+0

謝謝Awais,它沒有解決我的問題,但我找到了解決方案。這是服務器的錯。當我在本地主機上嘗試你的代碼(或我的代碼)時,它正在工作,但1n3k.com和我試圖調用的域在同一臺服務器上。所以,這是DNS或類似的事情。感謝至少迫使我嘗試本地:) – ahmetertem