PHP code example of max13 / push

1. Go to this page and download the library: Download max13/push 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/ */

    

max13 / push example snippets



// Adapt the path to your installation
ling slash
$mx = new MXRequestManager('http://api.awsome-guy.com');

// Prepare your parameters, i.e a token
$params = array('token' => 'abcdefg');

// Make the request and return the status
$res = $mx->get('/users', $params);

// MXRequestManager error,
// errno are in the top of the lib file
if ($res === FALSE)
	die('Client error: '.$mx->errno());
if ($res === TRUE) // No JSON, may be a PHP Error
	die('Parse error: '.$mx->response('body'));


echo 'User n0: ' . $res->users[0]->id . "<br />\n";
foreach ($res->users as $user)
	echo $user->id . ' / ' . $user->username . "<br />\n";


echo $mx->rawResponse();


// Adapt the path to your installation
ling slash
$mx = new MXRequestManager('http://api.awsome-guy.com');

// Prepare your parameters, i.e a token
$params = array('token' => 'abcdefg');

// Make the request and return the status
$res = $mx->get('/users', $params);

// MXRequestManager error,
// errno are in the top of the lib file
if ($res === FALSE)
	die('Client error: '.$mx->errno());
if ($res === TRUE) // No JSON, may be a PHP Error
	die('Parse error: '.$mx->response('body'));

echo "HTTP Status: " . $mx->response('headers', 'Status');
echo "<br />\n";
echo "HTTP Code: " . $mx->response('headers', 'Code');
// Since PHP 5.4 you can use $mx->response()['headers']
echo "<br />\n";
echo "Response body: " . $mx->response('body');