I am working with Magento Rest API for the first time, i went through the tutorials of Rest API on http://www.magentocommerce.com/api/rest
and tried one example to fetch product through API:
$callbackUrl = "http://localhost/wineshop/products.php";
$temporaryCredentialsRequestUrl = "http://localhost/wineshop/oauth/initiate? oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://localhost/wineshop/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://localhost/wineshop/oauth/token';
$apiUrl = 'http://localhost/wineshop/api/rest';
$consumerKey = 'u48p1x9gzrg7r82c94woa5z7g805uw0i';
$consumerSecret = '96ydrk8s89xxath8h5z71vcl5abfq0zg';
session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
$_SESSION['state'] = 0;
}
try {
$authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
$oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
$oauthClient->enableDebug();
I've also installed the latest version of OAUTH and it also shows in my WampServer PHP Extensions but it doesn't show in phpinfo()
. I coped the php_oauth.dll
file into ..\www\bin\php\ext
and i also edited php.ini
and entered extension=php_oauth.dll
but on running the products.php
it shows me the
Fatal error: Class 'OAuth' not found in P:\wamp\www\products.php on line 19
And i also want to know that how to request for the token i've got key
and secret
after entering new consumer in Magento Admin Panel. But i don't know how to get Access Token
& Access Token Secret
that we enter in RESTClient
Please Help, Thanks in advance