Home >Backend Development >PHP Tutorial >php-我用了curl代理,为什么抓取http://www.ip138.com 显示的还是实际ip

php-我用了curl代理,为什么抓取http://www.ip138.com 显示的还是实际ip

WBOY
WBOYOriginal
2016-06-02 11:31:341771browse

phpcurl

我在 http://ip.qiaodm.com/上面找的高匿代理
这是我的代码我curl用了代理ip做抓取,按理说应该显示的是我代理的ip但是还是显示的我的本机IP。 有谁知道为什么

function get_html($url,$data=array(),$html_char='UTF-8',$is_ssh='http'){

<code>           $ch = curl_init();               curl_setopt($ch, CURLOPT_URL, $url);             curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);            curl_setopt($ch, CURLOPT_PROXY,'111.12.117.67');            curl_setopt($ch, CURLOPT_PROXYPORT,'83');            curl_setopt ($ch, CURLOPT_HTTPHEADER, array('CLIENT-IP:113.207.63.26', 'X-FORWARDED-FOR:113.207.63.26'));           curl_setopt ($ch, CURLOPT_TIMEOUT, 6000);               curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/2008052906 Firefox/3.0');           if($is_ssh=='SSL'){           curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);            }           curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);             if(!empty($data)){                       curl_setopt($ch, CURLOPT_POST, true);                           curl_setopt($ch, CURLOPT_POSTFIELDS, $data);                         }           $output = curl_exec($ch);            if($html_char!='UTF-8'){                $output=mb_convert_encoding($output, "UTF-8", $html_char);             }                          $info = curl_getinfo($ch);           curl_close($ch);        $returntemp = array('output'=>$output,'info'=>$info);        return $returntemp['output'];       }</code>

$url='http://www.ip138.com/';
$date=get_html($url);

echo $date;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn