fopen():SSL:php中的对等错误重置连接

fopen():SSL:php中的对等错误重置连接,php,curl,ssl,libcurl,fopen,Php,Curl,Ssl,Libcurl,Fopen,我试图从我的bing广告帐户下载报告,但遇到以下错误: 警告:fopen():SSL:xxxx中的对等方重置连接。。。 警告:fopen():无法在xxx中启用加密 function PollGenerateReport($proxy, $reportRequestId) { // Set the request information. $request = new PollGenerateReportRequest();

我试图从我的bing广告帐户下载报告,但遇到以下错误: 警告:fopen():SSL:xxxx中的对等方重置连接。。。 警告:fopen():无法在xxx中启用加密

      function PollGenerateReport($proxy, $reportRequestId)
      {
         // Set the request information.

         $request = new PollGenerateReportRequest();
         $request->ReportRequestId = $reportRequestId;

         return $proxy->GetService()->PollGenerateReport($request)->ReportRequestStatus;
         return $proxy->GetService()->PollGenerateReport($request)>ReportRequestStatus;
       }

      // Using the URL that the PollGenerateReport operation returned,
      // send an HTTP request to get the report and write it to the specified
      // ZIP file.
      function DownloadFile($reportDownloadUrl, $downloadPath)
      {
          if (!$reader = fopen($reportDownloadUrl, 'rb'))
           {
               throw new Exception("Failed to open URL " . $reportDownloadUrl . ".");
           }
           if (!$writer = fopen($downloadPath, 'wb'))
           {
               fclose($reader);
               throw new Exception("Failed to create ZIP file " . $downloadPath . ".");
            }
            $bufferSize = 100 * 1024;

            while (!feof($reader))
            {
                if (false === ($buffer = fread       ($reader, $bufferSize)))
                 {
                    fclose($reader);
                    fclose($writer);
                    throw new Exception("Read operation from URL failed.");
                 }
                 if (fwrite($writer, $buffer) === false)
                 {
                     fclose($reader);
                     fclose($writer);
                     $exception = new Exception("Write operation to ZIP file failed.");
                 }
              }
                 fclose($reader);
                 fflush($writer);
                 fclose($writer);
         }
因为我是php的新手,所以我请求任何关于如何将fopen()函数(从研究来看,这似乎是这里的问题)转换为curl的帮助/技巧。我正在使用bing API下载报告并在服务器上运行脚本。
谢谢。

我的第一个想法是URL可能有密码保护

如果可能,最好先导出报告,然后在服务器上导入


或者,看看BING是否有关于如何从外部访问其报告的文档,是否有API(应用程序协议接口)?

我已经在使用BING API,并且我已经传递了必要的凭据(用户名、密码)。SSL和它有什么关系?在您的问题中,您没有提到任何关于API和凭据的内容。听起来你只是在用浏览器登录?请考虑浏览器不是服务器的事实。如果您使用webbrowser登录,则凭据将“存储”在该程序中。您的PHP Web服务器无权访问它们。从BING服务器的角度来看,它只是一个新的客户端。这很公平。不过,我正在服务器上运行包含用户凭据的脚本。如果这是一个PHP脚本,并且它创建了到BING服务器的安全连接,那么该连接(并且只有该连接)才能工作。您不能只使用fopen()创建一个没有任何凭据的全新连接。这样的连接将被拒绝。@KIKI软件。谢谢你,伙计。第一个理由你是对的。我没有足够的权限下载URL。修好了。