我想用代理创建一个 curl 并找到代理基本示例的 Ip
我写的代码属于follow
<?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));
?>