PHP code example of mobtexting / php-http-client
1. Go to this page and download the library: Download mobtexting/php-http-client library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mobtexting / php-http-client example snippets
$token = 'xxxx';
$headers = ['Authorization: Bearer ' . $token];
$client = new Mobtexting\Client('https://api.example.com', $headers);
$data = [
'some' => 1, 'awesome' => 2, 'data' => 3
];
$queryParams = [
'hello' => 0, 'world' => 1
];
$requestHeaders = [
'X-Test' => 'test'
];
$response = $client->post($data, $queryParams, $requestHeaders);
var_dump(
$response->statusCode(),
$response->headers(),
$response->body()
);