PHP code example of ocjojo / op-restclient
1. Go to this page and download the library: Download ocjojo/op-restclient 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/ */
ocjojo / op-restclient example snippets
php
$api = new OPRestclient\Client([
'base_url' => "https://jsonplaceholder.typicode.com"
]);
// GET https://jsonplaceholder.typicode.com/posts/1?param_1=hello¶m_2=world
$result = $api->posts->{1}->get([
'param_1' => "hello",
'param_2' => "world"
]);
if($result->info->http_code == 200)
var_dump($result->decode_response());