나는 컬 설정할 수 있는 프록시 서버를 사용하는 데. 이 url 은 html 양식을 제공하는 않은 문제다. 가상본 작동하잖아 좋았소 없이 그러나 나는 이 및 기타 사이트를 찾을 수 있는 코드를 사용할 수 없습니다. 어떤 도움이 될 수 있는 최적의 솔루션을 찾는 고맙군. 그러나 나는 이 벨로 닫으십시오 무언가 빠진 느낌이 있다. 감사합니다.
하지만 이 코드 내가 여기 발췌 벨로 (http://www.webmasterworld.com/forum88/10572.htm) 에 대한 오류 메시지가 되돌려줍니다 누각되었습니다 t_variable 12 라인.
<?
$url = '$_POST[1]';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_PROXY, '66.96.200.39:80');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'GET');
curl_setopt ($ch, CURLOPT_HEADER, 1)
curl_exec ($ch);
$curl_info = curl_getinfo($ch);
curl_close($ch);
echo '<br />';
print_r($curl_info);
?>
(Https://stackoverflow.com/questions/4802816/curl-through-proxy-returns-no-content) 에서 이 벨로
<?
$proxy = "66.96.200.39:80";
$proxy = explode(':', $proxy);
$url = "$_POST[1]";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, $proxy[0]);
curl_setopt($ch, CURLOPT_PROXYPORT, $proxy[1]);
curl_setopt($ch, CURLOPT_HEADER, 1);
$exec = curl_exec($ch);
echo curl_error($ch);
print_r(curl_getinfo($ch));
echo $exec;
?>
현재 살고 있는 pelican-cement.com 물론 작동하지 않습니다.
업데이트: Thank you for all your 도움말에서는 I made 위의 변경. 이제 빈 화면을 되돌려줍니다 뿐입니다.
<?
$url = $_POST['1'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_PROXY, '66.96.200.39:80');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'GET');
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_exec ($ch);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
echo $curl_scraped_page;
?>
다음은 작업 버전에 맞게 버그를 재거됨.
$url = 'http://dynupdate.no-ip.com/ip.php';
$proxy = '127.0.0.1:8888';
//$proxyauth = 'user:password';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
echo $curl_scraped_page;
또 '나는' CURLOPT_PROXYUSERPWD 필요한 경우에 사용자 이름과 암호를 프록시를 필요합니다. 내가 돌아갈 수 있도록 데이터 세트 'CURLOPT_RETURNTRANSFER' 1 ',' $ curl_scraped_page 변수다.
두 번째 추가 ' ($ ch),' 내가 재거됨 curl_exec 변수가 되는 정지점을 기술입니까 반환되었습니다. 난 당신의 가상본 IP 및 포트 하나로 통합된 설정값입니다.
난 또 CURLOPT_HTTPPROXYTUNNEL 재거됨 '' 도 '와' CURLOPT_CUSTOMREQUEST 전송되었기 기본값입니다.
가상본 비활성화하려면 null 로 설정하면 된다.
curl_setopt($ch, CURLOPT_PROXY, null);
Feel free to ask, 내가 모든 질문에 '컬' 작동합니까 매일.
나는 다양한 옵션을 사용하여 컬 (curl 가상본 요구됩니까 설명했다.
$url = 'http://dynupdate.no-ip.com/ip.php';
$proxy = '127.0.0.1:8888';
$proxyauth = 'user:password';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); // URL for CURL call
curl_setopt($ch, CURLOPT_PROXY, $proxy); // PROXY details with port
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth); // Use if proxy have username and password
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); // If expected to call with specific PROXY type
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // If url has redirects then go to the final redirected URL.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); // Do not outputting it out directly on screen.
curl_setopt($ch, CURLOPT_HEADER, 1); // If you want Header information of response else make 0
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
echo $curl_scraped_page;
이 기능을 사용할 수 있는 내가 내 사업을 함께 자세한 설명을 잘 테스트되었습니다 자체 설명
때 아닌 다른 서버에서 80 번 포트를 차단되었음을 많다 그래서 코드가 아닌 것으로 방화벽 apc® 로컬호스트 서버에 대해 과태료
function get_page($url){
global $proxy;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_HEADER, 0); // return headers 0 no 1 yes
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return page 1:yes
curl_setopt($ch, CURLOPT_TIMEOUT, 200); // http request timeout 20 seconds
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Follow redirects, need this if the url changes
curl_setopt($ch, CURLOPT_MAXREDIRS, 2); //if http server gives redirection responce
curl_setopt($ch, CURLOPT_USERAGENT,
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); // cookies storage / here the changes have been made
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // false for https
curl_setopt($ch, CURLOPT_ENCODING, "gzip"); // the page encoding
$data = curl_exec($ch); // execute the http request
curl_close($ch); // close the connection
return $data;
}