curl
代码语言:javascript
复制curl http://www.icanhazip.com/
curl -x 127.0.0.1:3128 http://www.icanhazip.com/
socks5
代码语言:javascript
复制curl --socks5 127.0.0.1:3129 http://www.icanhazip.com/
php
代码语言:javascript
复制define(URL, 'http://www.icanhazip.com/');
define(PROXY, '127.0.0.1');
define(PORT, 3128);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, URL);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt($curl, CURLOPT_PROXY, PROXY);
curl_setopt($curl, CURLOPT_PROXYPORT, PORT);
//curl_setopt($curl, CURLOPT_PROXYUSERPWD, "代理用户名:代理密码");
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$tmpInfo = curl_exec($curl);
curl_close($curl);
echo $tmpInfo;