title: Bus Schedule - API wmata - PHP
body: <p>I am trying (for learning purpose) to get a specific Real-Time Bus Predictions from the API of Washington Metropolitan Area; <a href="https://developer.wmata.com" rel="nofollow noreferrer">https://developer.wmata.com</a> and <a href="https://developer.wmata.com/docs/services/5476365e031f590f38092508/operations/5476365e031f5909e4fe331d" rel="nofollow noreferrer">Real-Time Bus Predictions</a></p>
  
  <p>Bus Stop ID: <strong>3001954</strong></p>
  
  <p>Api Key: This is a Demo Api Key that can be use for demo: <strong>e13626d03d8e4c03ac07f95541b3091b</strong> Source: <a href="https://developer.wmata.com/demokey" rel="nofollow noreferrer">https://developer.wmata.com/demokey</a></p>
  
  <p>I am trying to use their PHP JSON example code, but nothing is happing.  I am missing something? Any suggestions please? Thank you so much in advance for your help.</p>
  
  <pre><code>&lt;?php
  // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
  require_once 'HTTP/Request2.php';
  
  $request = new Http_Request2('https://api.wmata.com/NextBusService.svc/json/jPredictions');
  $url = $request-&gt;getUrl();
  
  $headers = array(
      // Request headers
      'api_key' =&gt; 'e13626d03d8e4c03ac07f95541b3091b',
  );
  
  $request-&gt;setHeader($headers);
  
  $parameters = array(
      // Request parameters
      'StopID' =&gt; '3001954',
  );
  
  $url-&gt;setQueryVariables($parameters);
  
  $request-&gt;setMethod(HTTP_Request2::METHOD_GET);
  
  // Request body
  $request-&gt;setBody("{body}");
  
  try
  {
      $response = $request-&gt;send();
      echo $response-&gt;getBody();
  }
  catch (HttpException $ex)
  {
      echo $ex;
  }
  
  ?&gt;
  </code></pre>
  
  <p>Maybe I am missing something here? <code>$request-&gt;setBody("{body}");</code></p>