은 컬 (curl) 요청의 아웃풋을 PHP 변수에 저장하는 옵션입니다.cURL 출력 변수를 변수로 저장 PHP
난 단지 $ 결과를 저장하는 경우 때문에 1 또는 아무것도 true로 CURLOPT_RETURNTRANSFER
옵션을 설정해야합니다
<?php
$url='http://icanhazip.com';
$proxy=file ('proxy.txt');
$useragent='Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
for($x=0;$x<count($proxy);$x++)
{
$ch = curl_init();
//you might need to set some cookie details up (depending on the site)
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_URL,$url); //set the url we want to use
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_PROXY, $proxy[$x]);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); //set our user agent
$result= curl_exec ($ch); //execute and get the results
print $result; //display the reuslt
$datenbank = "proxy_work.txt";
$datei = fopen($datenbank,"a");
fwrite($datei, $result);
fwrite ($datei,"\r\n");
curl_close ($ch);
}
?>
[여기]의 "CURLOPT_RETURNTRANSFER"(http://www.php.net/manual/en/function.curl-setopt.php)에서 검색하십시오. – Passerby