【发布时间】:2014-09-22 06:24:11
【问题描述】:
有没有办法,在 PHP 中更改 tor 出口节点(获取新 IP)?
现在,我每 10 分钟左右获得一次新 IP..
<?php
// Initialize cURL
$ch = curl_init();
// Set the website you would like to scrape
curl_setopt($ch, CURLOPT_URL, "http://icanhazip.com/");
curl_setopt($ch, CURLOPT_USERAGENT, '');
curl_setopt($ch, CURLOPT_REFERER, '');
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8118');
// Set cURL to return the results into a PHP variable
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// This executes the cURL request and places the results into a variable.
$curlResults= curl_exec($ch);
// Close curl
curl_close($ch);
// Echo the results to the screen>
echo $curlResults;
?>
【问题讨论】:
-
@JimL - 不是重复的,那个问题不是 PHP
-
This 可能会有所帮助
-
我发现了这个:github.com/dapphp/TorUtils