title: PHP and Bing Translation API
body: <p>I've registered with Azure Marketplace, I have a client ID and a client "secret", but everything I've tried so far nonetheless results in a "400 Bad Request" error.  Thanks very much!</p>
  
  <p>Here is a rather basic sample of the code I've been trying (I've redacted the Client ID and Secret Value).  I'm operating with the understanding that the post variables can be passed through the URL request... I hope that's correct.</p>
  
  <pre><code>$authURL = 'http://datamarket.accesscontrol.windows.net/v2/OAuth2-13&amp;grant_type=client_credentials&amp;client_id={CLIENT_ID VALUE HERE}&amp;client_secret={CLIENT_SECRET VALUE HERE}&amp;scope=http://api.microsofttranslator.com';
  $chpre = curl_init();
  curl_setopt($chpre, CURLOPT_URL, $authURL );
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  $xpre = curl_exec($chpre);
  
  $texttobetranslated = "الذي تقدمه";
  $BingURL = "http://api.microsofttranslator.com/v2/Http.svc/Translate?text=" . $texttobetranslated . "&amp;from=ar&amp;to=en";
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $BingURL );
  $x = curl_exec($ch);
  </code></pre>