且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

THttpClient 无法打开流:HTTP 请求失败!HTTP/1.1 400 错误请求

更新时间:2021-12-01 00:23:34

这里是 THttpClient 调用的问题.第一个参数应该是主机,uri 应该在第三个参数中.

Here was the issue with the THttpClient call. The first parameter should be the host and the uri should be in the 3rd parameter.

所以调用它的确切方法是

so the exact way to call it is

$result = json_decode(exec('./Authenticator.py'));
$liveURL = $result->secureUrl;
$liveURI = preg_replace('#^https?://edenremote.paceap.com#', '', rtrim($result->secureUrl,'/'));
$socket = new THttpClient('edenremote.paceap.com', 80, $liveURI, 'https');
$socket->setTimeoutSecs(50);
$transport = new TBufferedTransport($socket, 1024, 1024);
$protocol = new TBinaryProtocol($transport);
$client = new \edenremotephp\pub\EdenRemote\EdenRemoteClient($protocol);
$transport->open();
$client->openSession($result->sessionID, 1);
$isExist = $client->findUserByEmailAddress($result->sessionID, $account->primaryEmail);
var_dump($isExist);
$client->closeSession($result->sessionID);
echo 'Done';