Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Proxy 如何在curl的随机代理脚本中确定IP和端口?_Proxy_Curl - Fatal编程技术网

Proxy 如何在curl的随机代理脚本中确定IP和端口?

Proxy 如何在curl的随机代理脚本中确定IP和端口?,proxy,curl,Proxy,Curl,我有一个用于curl的随机IP脚本,但我不知道如何为同一个随机脚本使用端口: function curl_get($kix) { $ips = array( '85.10.230.132', '88.198.242.9', '88.198.242.10', '88.198.242.11', '88.198.242.12', '88.198.242.13', '88.198.242.14', ); $ch = curl_init(); curl_seto

我有一个用于
curl
的随机IP脚本,但我不知道如何为同一个随机脚本使用端口:

function curl_get($kix) 
{
 $ips = array(
  '85.10.230.132',
  '88.198.242.9',
  '88.198.242.10',
  '88.198.242.11',
  '88.198.242.12',
  '88.198.242.13',
  '88.198.242.14',
    );
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_URL, $kix);
 @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
 curl_setopt($ch, CURLOPT_INTERFACE, $ips[rand(0, count($ips)-1)]);
    curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
 $html = curl_exec($ch);
 curl_close($ch);
 return $html;
}
你可以看到这里我提到了IP,但我不知道如何提到这些IP的端口


提前感谢。

这些是接口。接口可以是名称或ip(即eth0)。您没有指定端口。

这些是接口。接口可以是名称或ip(即eth0)。您不需要指定端口。

阅读PHP Curl模块文档。阅读PHP Curl模块文档。