title: Error while using REST api in magento
body: <p>I have set up magento locally in my system using XAMPP</p>
  
  <p>I have created a file in root directory named dm.php with the contents</p>
  
  <pre><code>&lt;?php
  /**
  * Example of products list retrieve using Customer account via Magento REST API. OAuth authorization is used
  */
  $callbackUrl = "http://localhost/dm.php";
  $temporaryCredentialsRequestUrl = "http://localhost/mage2/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
  $adminAuthorizationUrl = 'http://localhost/mage2/oauth/authorize';
  $accessTokenRequestUrl = 'http://localhost/mage2/oauth/token';
  $apiUrl = 'http://localhost/mage2/api/rest';
  $consumerKey = 'enhksf7u33p3snubewb6zcq0z9c63bvv';
  $consumerSecret = 'p7e835cdcxofokeep749jgzz4l1e306p';
  
  session_start();
  if (!isset($_GET['oauth_token']) &amp;&amp; isset($_SESSION['state']) &amp;&amp; $_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-&gt;enableDebug();
  
      if (!isset($_GET['oauth_token']) &amp;&amp; !$_SESSION['state']) {
          $requestToken = $oauthClient-&gt;getRequestToken($temporaryCredentialsRequestUrl);
          $_SESSION['secret'] = $requestToken['oauth_token_secret'];
          $_SESSION['state'] = 1;
          header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
          exit;
      } else if ($_SESSION['state'] == 1) {
          $oauthClient-&gt;setToken($_GET['oauth_token'], $_SESSION['secret']);
          $accessToken = $oauthClient-&gt;getAccessToken($accessTokenRequestUrl);
          $_SESSION['state'] = 2;
          $_SESSION['token'] = $accessToken['oauth_token'];
          $_SESSION['secret'] = $accessToken['oauth_token_secret'];
          header('Location: ' . $callbackUrl);
          exit;
      } else {
          $oauthClient-&gt;setToken($_SESSION['token'], $_SESSION['secret']);
          $resourceUrl = "$apiUrl/products";
          $oauthClient-&gt;fetch($resourceUrl);
          $productsList = json_decode($oauthClient-&gt;getLastResponse());
          print_r($productsList);
      }
  } catch (OAuthException $e) {
      print_r($e);
  }
  </code></pre>
  
  <p>But this is giving me the following error</p>
  
  <pre><code>Fatal error: Class 'OAuth' not found in D:\Webserver\xampp\htdocs\dm.php on line 19
  </code></pre>
  
  <p>Can anybody shed some light on this
  Thanks</p>
  
  <p>Since oauth is not possible to install in xampp windows i changed the contents of my dm.php file to this.</p>
  
  <pre><code>&lt;?php
  $ch = curl_init('http://localhost/mage2/api/rest/customers');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $customers = curl_exec($ch);
  echo $customers;
  ?&gt;
  </code></pre>
  
  <p>Now i am getting an error like this</p>
  
  <pre><code>{"messages":{"error":[{"code":403,"message":"Access denied"}]}}
  </code></pre>
  
  <p>What am i doing wrong?</p>