Closed joseorono closed 1 year ago
Hi @joseorono, Thanks for your input. I agree this is most likely a slow response from our server.
I'm afraid some of the request for a number are quite slow. What you could try is adding the required features for the number to the request and see if that helps in this case.
features | array | The feature of a phone number. Possible values: sms, voice, mms.
From: https://developers.messagebird.com/api/numbers/#searching-phone-numbers-available-for-purchase
An alternative would be to set a custom timeout for the HttpClient
. You can do so as follows:
$messageBird = new \MessageBird\Client('YOUR_ACCESS_KEY', new HttpClient("https://numbers.messagebird.com/v1", 30));
Closing as part of cleanup. Feel free to re-open if needed.
We often get a "Operation timed out" from MessageBird when requesting the available phone numbers using MessageBird's PHP SDK.
Here's the error itself:
string(66) "Operation timed out after 10001 milliseconds with 0 bytes received"
We're using really standard code, taken straight from the examples you guys provide on GitHub. I've attached a screenshot of the code we use to make the request, but given the simplistic nature of it, this is almost certainly a problem on MessageBird's end. We've tested this code on localhost at multiple locations and on our production servers and the error persists no matter what. Our version of the library is really recent ("^3.1" as defined by Composer. We're only just integrating MessageBird into our site) so this is not likely not due to outdated software.
try { $phoneNumbers = $messageBird->availablePhoneNumbers->getList("us", []); $price = $messageBird->price=true; //var_dump($phoneNumbers); } catch (\MessageBird\Exceptions\AuthenticateException $e) { var_dump($e->getMessage()); // That means that your accessKey is unknown print("wrong login\n"); } catch (\Exception $e) { var_dump($e->getMessage()); }