源码如下:

<?php
$ch = curl_init();
$timeout = 10;
$proxy="IP:端口";
$proxyauth = '账号:密码';
curl_setopt ($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL,"http://网址");
$file_contents = curl_exec($ch);
if (curl_errno($ch)) {
echo 'error: ' . curl_error($ch)."\r\n";
}
echo $file_contents;
curl_close($ch);

Related Posts: PHP-curl检测包含账号密码的HTTP代理访问情况 :