我想用PHP中的代理查找ip基本示例创建curl

时间:2012-10-08 12:48:43

标签: php curl proxy

我想用代理&创建一个卷曲找到代理基本示例的Ip

我写了一个代码属于

<?php
$proxy_ip = '76.27.149.203';
$proxy_port = '8080';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://automation.whatismyip.com/n09230945.asp");
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*"));
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port);
    curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
    curl_setopt( $ch, CURLOPT_AUTOREFERER, 1);
    $head = curl_exec($ch);
    var_dump($head);
    //var_dump(curl_getinfo($ch));
?>

0 个答案:

没有答案