Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>after days of argument with microsoft techinchal support they accpeted that it didnt work </p> <p><strong>here is the proper coding which uses CURL do this in the BING API, apply CURL method instead of the file_get_contents which can’t pass the correct authentication information from Linux client to BING service.</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;PHP Bing&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF'];?&gt;"&gt; Type in a search: &lt;input type="text" id="searchText" name="searchText" value="&lt;?php if (isset($_POST['searchText'])) { echo($_POST['searchText']); } else { echo('sushi'); } ?&gt;" /&gt; &lt;input type="submit" value="Search!" name="submit" id="searchButton" /&gt; &lt;?php if (isset($_POST['submit'])) { $credentials = "username:xxx"; $url= "https://api.datamarket.azure.com/Bing/SearchWeb/Web?Query=%27{keyword}%27"; $url=str_replace('{keyword}', urlencode($_POST["searchText"]), $url); $ch = curl_init(); $headers = array( "Authorization: Basic " . base64_encode($credentials) ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $rs = curl_exec($ch); echo($rs); curl_close($ch); return $rs; } ?&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload