本文介绍了托尔:“ SIGNAL NEWNYM\r\n”的声音导致fread空响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道为什么吗

fputs($fp, "SIGNAL NEWNYM\r\n");
$response = fread($fp, 1024);

返回空的$ response(在Windows上)?在尝试所有
i 5小时后,我无法使用它。

return an empty $response (on windows)? i can't get it to work after 5 hours trying everythingi use the code in:

$fp = fsockopen('localhost', 9051, $errno, $errstr, 30);
    $auth_code = 'a-password';
    if ($fp) {
        echo "Connected to TOR port<br />";
    }
    else {
        echo "Cant connect to TOR port<br />";
    }

    fputs($fp, "AUTHENTICATE \"".$auth_code."\"\r\n");
    $response = fread($fp, 1024);
    list($code, $text) = explode(' ', $response, 2);
    if ($code = '250') {
        echo "Authenticated 250 OK<br />";
    }
    else {
        echo "Authentication failed<br />";
    }

    fputs($fp, "SIGNAL NEWNYM\r\n");
    $response = fread($fp, 1024); 

我的目标是让TOR为每个请求使用新的ip

it is my goal to have TOR usinga new ip for every request

推荐答案

您说对了!
有时大约需要8秒钟才能获得新的IP。
日志:
1月16日18:27:54.000 [注意]限速NEWNYM请求:延迟3秒
1月16日18:28:00.000 [注意]新的控制连接已打开从127.0.0.1。
Jan 16 18:28:00.000 [notice]限速NEWNYM请求:延迟7秒

You are right!sometimes it takes like 8 seconds before an new ip is optained.logs:Jan 16 18:27:54.000 [notice] Rate limiting NEWNYM request: delaying by 3 second(s)Jan 16 18:28:00.000 [notice] New control connection opened from 127.0.0.1.Jan 16 18:28:00.000 [notice] Rate limiting NEWNYM request: delaying by 7 second(s)

这篇关于托尔:“ SIGNAL NEWNYM\r\n”的声音导致fread空响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 19:45