PHP Requires Chilkat v11.0.0+
Chilkat2 PHP
BrickLink OAuth1 using Chilkat HTTP
See more BrickLink Examples
Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat HTTP.Chilkat PHP Downloads
<?php
use Chilkat2\Http;
use Chilkat2\HttpResponse;
use Chilkat2\JsonObject;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$http = new Http();
$http->OAuth1 = true;
$http->OAuthConsumerKey = 'Your Consumer Key';
$http->OAuthConsumerSecret = 'Your Consumer Secret';
$http->OAuthToken = 'Your OAuth1 Token';
$http->OAuthTokenSecret = 'Your Token Secret';
$http->OAuthSigMethod = 'HMAC-SHA1';
$resp = new HttpResponse();
try {
$http->HttpNoBody('GET', 'https://api.bricklink.com/api/store/v1/orders?direction=in', $resp);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
echo 'Response status code = ', $resp->StatusCode, "\n";
$json = new JsonObject();
$resp->GetBodyJson($json);
$json->EmitCompact = false;
echo $json->Emit(), "\n";