<small id='iPvht'></small><noframes id='iPvht'>

    <i id='iPvht'><tr id='iPvht'><dt id='iPvht'><q id='iPvht'><span id='iPvht'><b id='iPvht'><form id='iPvht'><ins id='iPvht'></ins><ul id='iPvht'></ul><sub id='iPvht'></sub></form><legend id='iPvht'></legend><bdo id='iPvht'><pre id='iPvht'><center id='iPvht'></center></pre></bdo></b><th id='iPvht'></th></span></q></dt></tr></i><div id='iPvht'><tfoot id='iPvht'></tfoot><dl id='iPvht'><fieldset id='iPvht'></fieldset></dl></div>
  • <tfoot id='iPvht'></tfoot>

      <legend id='iPvht'><style id='iPvht'><dir id='iPvht'><q id='iPvht'></q></dir></style></legend>
        <bdo id='iPvht'></bdo><ul id='iPvht'></ul>
      1. 用于 PHP 中 Bing 搜索的 Windows Azure 身份验证

        时间:2023-11-30

          • <i id='EPIAf'><tr id='EPIAf'><dt id='EPIAf'><q id='EPIAf'><span id='EPIAf'><b id='EPIAf'><form id='EPIAf'><ins id='EPIAf'></ins><ul id='EPIAf'></ul><sub id='EPIAf'></sub></form><legend id='EPIAf'></legend><bdo id='EPIAf'><pre id='EPIAf'><center id='EPIAf'></center></pre></bdo></b><th id='EPIAf'></th></span></q></dt></tr></i><div id='EPIAf'><tfoot id='EPIAf'></tfoot><dl id='EPIAf'><fieldset id='EPIAf'></fieldset></dl></div>
              <tbody id='EPIAf'></tbody>
              <bdo id='EPIAf'></bdo><ul id='EPIAf'></ul>

                <legend id='EPIAf'><style id='EPIAf'><dir id='EPIAf'><q id='EPIAf'></q></dir></style></legend>
                <tfoot id='EPIAf'></tfoot>
                • <small id='EPIAf'></small><noframes id='EPIAf'>

                  本文介绍了用于 PHP 中 Bing 搜索的 Windows Azure 身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 Windows Azure Marketplace API 执行必应搜索,我已经下载了他们的指南和示例代码.该代码准备了一个带有基本身份验证的 HTTPS 请求,但是我不断收到以下错误:

                  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:

                  警告:file_get_contents(https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%27washburn%27&Adult=%27Off%27&$top=50&$format=Atom): 无法打开流:连接被拒绝

                  php 代码(来自微软的文档):

                  The php code (from Microsoft's document):

                  $context = stream_context_create(array(
                      'http' => array(
                      'proxy' => 'tcp://127.0.0.1:8888',
                      'request_fulluri' => true,
                      'header'  => "Authorization: Basic " . base64_encode($accountKey.":".$accountKey)
                      )
                  ));
                  

                  请问有谁知道是什么原因造成的?我已正确设置 $accountKey 并在浏览器中对其进行了测试.让我有点困惑的是 127.0.0.1:8888base64_encode($accountKey.":".$accountKey) ,你怎么需要 $accountKey 之前和之后: 使用浏览器时,您应该将用户名留空,只需在密码字段中输入帐户密钥?

                  Does anyone know what is causing the error please? I have correctly set the $accountKey and I tested it in a browser. What puzzles me a little is 127.0.0.1:8888 and also base64_encode($accountKey.":".$accountKey) , how come you need the $accountKey both before and after the : while when using a browser you are supposed to leave the username blank and just input the account key into the password field?

                  推荐答案

                  我已经解决了,下面是我为将来会做同样事情的人发现的:

                  I have solved it and here is what I have found for future people that would be doing the same thing:

                  我注释掉了上面写着的那一行:

                  I commented out the line where it says:

                  'proxy' => 'tcp://127.0.0.1:8888',
                  'request_fulluri' => true,
                  

                  并设置 base64_encode("ignored:".$accountKey) 代替

                  根据我在 MSDN 上阅读的内容,据说用户名部分被忽略,因此它的值应该是什么并不重要.我在想可能是密钥中的长度或特殊字符搞砸了,所以我用 ignored (或其他任何东西)替换它.

                  Base on what I read on MSDN, the username part is said to be ignored, so it shouldn't matter what value it is. I was thinking perhaps the length or the special characters in the key screwed things up so I replaces it with ignored (or anything really).

                  成功了,我可以解析返回的 JSON 数据.祝你好运!

                  That did the trick and I can parse the returned JSON data. Good luck!

                  这篇关于用于 PHP 中 Bing 搜索的 Windows Azure 身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:PHP中重定向标头之后的所有代码都会被执行吗? 下一篇:Python 替换 PHP 的标头

                  相关文章

                  1. <small id='Cili5'></small><noframes id='Cili5'>

                    • <bdo id='Cili5'></bdo><ul id='Cili5'></ul>
                    <legend id='Cili5'><style id='Cili5'><dir id='Cili5'><q id='Cili5'></q></dir></style></legend>

                  2. <tfoot id='Cili5'></tfoot>
                    1. <i id='Cili5'><tr id='Cili5'><dt id='Cili5'><q id='Cili5'><span id='Cili5'><b id='Cili5'><form id='Cili5'><ins id='Cili5'></ins><ul id='Cili5'></ul><sub id='Cili5'></sub></form><legend id='Cili5'></legend><bdo id='Cili5'><pre id='Cili5'><center id='Cili5'></center></pre></bdo></b><th id='Cili5'></th></span></q></dt></tr></i><div id='Cili5'><tfoot id='Cili5'></tfoot><dl id='Cili5'><fieldset id='Cili5'></fieldset></dl></div>