0

I am trying to buy or rent number from plivo using its api but in return i always get

{ "api_id": "424ce834-6498-11ec-aca5-0242ac110002", "error": "not found" }

i tried every thing but it did not work

here is the code $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, "https://api.plivo.com/v1/Account/".$auth_id."/PhoneNumber/12513284788/");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_USERPWD, $auth_id . ':' . $auth_token);

        $headers = array();
        $headers[] = 'Content-Type: application/json';
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

        $result = curl_exec($ch);

2 Answers2

1

It seems like you're trying to use subaccount credentials to purchase a number. You must use main account credentials, which are available on the Plivo dashboard. To assign a number to a subaccount, you can use the Update a Number API by specifying the respective subaccount Auth_ID as payload in the request.

If you have any questions or concerns, please reach out to our round-the-clock support team. Thanks!

0

the error is not about PHP curl execution, ist a valid response from plivo server, maybe $auth_id didn't set properly or for example there is an error about the rest of the API URL.

behzad m salehi
  • 1,038
  • 9
  • 23