dongpan8439
2017-05-10 13:29
浏览 135
已采纳

PHP套接字和Whatsapp代理

I'm building a small project regarding WhatsApp, and I'm using the https://github.com/mgp25/Chat-API, even though there's no longer support on the repo.

My issue is with sockets, and I'm using them to log in. The section of my code which is failing is :

<?php
$socket = fsockopen("e" . rand(1, 16) . ".whatsapp.net:" . Constants::PORT);
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array(
    'sec' => Constants::TIMEOUT_SEC,
    'usec' => Constants::TIMEOUT_USEC
));

socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array(
    'sec' => Constants::TIMEOUT_SEC,
    'usec' => Constants::TIMEOUT_USEC
));

?>

I'm getting the following error:

C:\MAMP\htdocs\WhatsappTestApp\whatsapp\src\whatsprot.class.php on line 305

[10-May-2017 15:11:13 Africa/Johannesburg] PHP Warning: socket_set_option(): supplied resource is not a valid Socket resource in C:\MAMP\htdocs\WhatsappTestApp\whatsapp\src\whatsprot.class.php on line 291

[10-May-2017 15:11:13 Africa/Johannesburg] PHP Warning: socket_set_option(): supplied resource is not a valid Socket resource in C:\MAMP\htdocs\WhatsappTestApp\whatsapp\src\whatsprot.class.php on line 296

[10-May-2017 15:11:13 Africa/Johannesburg] PHP Warning: socket_read(): supplied resource is not a valid Socket resource in C:\MAMP\htdocs\WhatsappTestApp\whatsapp\src\whatsprot.class.php on line 299

[10-May-2017 15:11:13 Africa/Johannesburg] PHP Fatal error: Uncaught FailedProxy: [0]: Failed proxy. Error 3

thrown in C:\MAMP\htdocs\WhatsappTestApp\whatsapp\src\whatsprot.class.php on line 301

1条回答 默认 最新

相关推荐 更多相似问题