Skip to content

Instantly share code, notes, and snippets.

@djekl
Created July 31, 2019 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djekl/626837e1c7b9532d1c17e2dff247e31f to your computer and use it in GitHub Desktop.
Save djekl/626837e1c7b9532d1c17e2dff247e31f to your computer and use it in GitHub Desktop.
Example on how to send a message using Guzzle via XboxAPI
<?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