title: Windows Azure Authentication for Bing Search in PHP
body: <p>I am trying to perform a Bing Search by using the Windows Azure Marketplace API, I have downloaded their guide and sample code. The code prepares a HTTPS request with basic authentication, however I am constantly getting the following error:</p>
  
  <p><code>Warning: file_get_contents(https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%27washburn%27&amp;Adult=%27Off%27&amp;$top=50&amp;$format=Atom): failed to open stream: Connection refused</code> </p>
  
  <p>The php code (from Microsoft's document):</p>
  
  <pre><code>$context = stream_context_create(array(
      'http' =&gt; array(
      'proxy' =&gt; 'tcp://127.0.0.1:8888',
      'request_fulluri' =&gt; true,
      'header'  =&gt; "Authorization: Basic " . base64_encode($accountKey.":".$accountKey)
      )
  ));
  </code></pre>
  
  <p>Does anyone know what is causing the error please? I have correctly set the <code>$accountKey</code> and I tested it in a browser. What puzzles me a little is <code>127.0.0.1:8888</code> and also <code>base64_encode($accountKey.":".$accountKey)</code> , how come you need the <code>$accountKey</code> both before and after the <code>:</code> while when using a browser you are supposed to leave the username blank and just input the account key into the password field?</p>