0

代码:

<?php
  $this->curlHandle = curl_init();

  $curl_options = $this->additionalCurlOptions + array(
    CURLOPT_COOKIEJAR => $this->cookieFile,
    CURLOPT_URL => $base_url,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_MAXREDIRS => 5,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_SSL_VERIFYPEER => FALSE, // Required to make the tests run on https.
    CURLOPT_SSL_VERIFYHOST => FALSE, // Required to make the tests run on https.
    CURLOPT_HEADERFUNCTION => array(&$this, 'curlHeaderCallback'),
  );
  if (isset($this->httpauth_credentials)) {
    $curl_options[CURLOPT_USERPWD] = $this->httpauth_credentials;
  }

  // curl_setopt_array() returns FALSE if any of the specified options
  // cannot be set, and stops processing any further options.
  $result = curl_setopt_array($this->curlHandle, $this->additionalCurlOptions + $curl_options);
?>

我需要弄清楚这些 curl 选项出了什么问题。如何调试curl_setopt_array()自身?由于 cookiejar 是一个(经过测试的)工作文件名,url 是正确的,header 函数正在工作,并且所有其他选项都是硬编码的,我应该怎么做才能更深入地挖掘?

4

1 回答 1

1

您应该使用复数curl_setopt而不是单数curl_setopt_array进行调试。

于 2013-05-12T22:46:20.300 回答