Save cURL Display Output String in Variable PHP -
is option save outpout of curl request in php variable?
because if save $result 1 or nothing
<?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 set cookie details (depending on site) curl_setopt($ch, curlopt_timeout, 1); curl_setopt($ch, curlopt_url,$url); //set url want 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 , results print $result; //display reuslt $datenbank = "proxy_work.txt"; $datei = fopen($datenbank,"a"); fwrite($datei, $result); fwrite ($datei,"\r\n"); curl_close ($ch); } ?>
you need set curlopt_returntransfer
option true.
curl_setopt($ch, curlopt_returntransfer, 1);
Comments
Post a Comment