Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ClientException in RequestException.php line 111:
- Client error: `POST https://api.infobip.com/sms/1/text/single` resulted in a `401 Unauthorized` response:
- {"requestError":{"serviceException": {"messageId":"UNAUTHORIZED","text":"Invalid login details"}}}
- $data= '{
- "from":"InfoSMS",
- "to":"923227124444",
- "text":"Test SMS."
- }';
- $userstring = 'myuserame:password';
- $id =base64_encode ( 'myuserame:password' );
- echo 'Basic '.$id;
- $client = new GuzzleHttpClient();
- $request = $client->post('https://api.infobip.com/sms/1/text/single',array(
- 'content-type' => 'application/json'
- ),['auth' => ['myusername', 'password']]);
- $request->setHeaders(array(
- 'accept' => 'application/json',
- 'authorization' => 'Basic '.$id,
- 'content-type' => 'application/json'
- ));
- $request->setBody($data); #set body!
- $response = $request->send();
- echo $res->getStatusCode(); // 200
- echo $res->getBody();
- return $response;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement