I am using this telegram api to make an api call. It works, but i cant get this result returned. This is what I have:
$loop = \React\EventLoop\Factory::create();
$handler = new HttpClientRequestHandler($loop);
$tgLog = new TgLog($token, $handler);
$webHookInfo = new GetWebhookInfo();
$promise = $tgLog->performApiRequest($webHookInfo);
$promiseResult = $promise->then(
function (WebhookInfo $info)
{
print 'Y';
return $info;
},
function (\Exception $e) {
print 'X';
return $e->getMessage();
}
);
$loop->run();
It prints the "Y" and I can even var_dump $info and see the result I want. But outside of that function, I cant access it. This is what I see if I var_dump($promiseResult):
object(React\Promise\Promise)#1582 (6) {
["canceller":"React\Promise\Promise":private]=>
NULL
["result":"React\Promise\Promise":private]=>
object(React\Promise\FulfilledPromise)#1597 (1) {
["value":"React\Promise\FulfilledPromise":private]=>
object(unreal4u\TelegramAPI\Telegram\Types\WebhookInfo)#1450 (8) {
["url"]=> string(84) "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
["has_custom_certificate"]=> bool(false)
["pending_update_count"]=> int(0)
["last_error_date"]=> int(1595489318)
["last_error_message"]=> string(20) "Read timeout expired"
["max_connections"]=> int(100)
["allowed_updates"]=> array(0) {
}
["logger":protected]=> object(unreal4u\Dummy\Logger)#1047 (0) {
}
}
}
["handlers":"React\Promise\Promise":private]=> array(0) {
}
["progressHandlers":"React\Promise\Promise":private]=> array(0) {
}
["requiredCancelRequests":"React\Promise\Promise":private]=> int(0)
["cancelRequests":"React\Promise\Promise":private]=> int(0)
}
I am actually after that url that I blanked out with X's. But there is no method on this object to get that value.
What am I missing?