curl_init与Twitter上的wordpress冲突



我正在Wordpress开发中使用Abraham Williams twitter库。我正处于验证所有内容的阶段,oAuth.php在主题森林所需的主题检查插件上产生了潜在的错误。

WARNING: curl_init was found in the file includes/resources/twitter/twitteroauth.php possible file operations.

WARNING: curl_exec was found in the file includes/resources/twitter/twitteroauth.php possible file operations.

这是在以下函数中

function http($url, $method, $postfields = NULL) {
    $this->http_info = array();
    $ci = curl_init();
    /* Curl settings */
    curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
    curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
    curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
    curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
    curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
    curl_setopt($ci, CURLOPT_HEADER, FALSE);
    switch ($method) {
      case 'POST':
        curl_setopt($ci, CURLOPT_POST, TRUE);
        if (!empty($postfields)) {
          curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
        }
        break;
      case 'DELETE':
        curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
        if (!empty($postfields)) {
          $url = "{$url}?{$postfields}";
        }
    }
    curl_setopt($ci, CURLOPT_URL, $url);
    $response = curl_exec($ci);
    $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
    $this->http_info = array_merge($this->http_info, curl_getinfo($ci));
    $this->url = $url;
    curl_close ($ci);
    return $response;
  }

有谁知道解决这个问题的方法?

注意

从进一步阅读建议使用

wp_remote_request()

对此有任何经验吗?

这不是错误,而是警告。

它看起来也不像来自 PHP,因为它不包含该行,并且 PHP 警告拼写WarningWARNING

这看起来像是Wordpress的一个安全功能,告诉你插件和脚本中的curl执行。

您应该在此处打开一个案例:http://wordpress.org/support/plugin/theme-check

最新更新