Created
July 31, 2019 07:06
-
-
Save djekl/626837e1c7b9532d1c17e2dff247e31f to your computer and use it in GitHub Desktop.
Example on how to send a message using Guzzle via XboxAPI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use GuzzleHttp\Pool; | |
use GuzzleHttp\Client; | |
use GuzzleHttp\Psr7\Request; | |
$client = new Client(); | |
$request = new Request( | |
"POST", | |
"https://xboxapi.com/v2/messages", | |
[ | |
"Content-Type" => "application/json", | |
"X-Auth" => "XboxAPI API KEY", | |
], | |
json_encode([ | |
'to' => [ | |
'2533274813081462', | |
], | |
'message' => 'Test Message', | |
]) | |
); | |
$response = $client->send($request); | |
echo "Response HTTP : " . $response->getStatusCode() . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment