2017-02-27 63 views
0

你好我試圖使用curl得到一個頁面,但總是得到錯誤403.有沒有什麼辦法可以得到這個網頁?curl php總是得到錯誤403

我的源代碼是這樣的

<?php 
set_time_limit(0); 
error_reporting(0); 
$LOGINURL = "https://sso.orange.fr/espace-client/desimlockage"; 
$ch = curl_init(); 
$headers[] = "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"; 
$headers[] = "Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4"; 
$headers[] = "Connection: Keep-Alive"; 
$headers[] = "Host:iz.orange.fr"; 
$headers[] = "Referer:http://www.sosh.fr/espace-client-accueil"; 
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: curl/7.39.0'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt($ch, CURLOPT_URL, $LOGINURL); 
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); 
$content = curl_exec($ch); 
echo $content; 
?> 
+0

也許你的IP是被禁止的,我得到' hanshenrik

+0

可能改變用戶-agent:http://www.useragentstring.com/pages/useragentstring.php – ZiTAL

回答

0

評論curl_setopt($ CH,CURLOPT_FOLLOWLOCATION,1);並嘗試一次。希望它會有所幫助。

0

完全不工作我改變了用戶代理,但同樣的問題