PHP的卷曲不适用于AppEngine

时间:2015-11-18 20:19:45

标签: php google-app-engine curl

在本地AppEngine上,curl请求会给出以下结果,这是我所期望的。

[url] => https://spreadsheets.google.com/feeds/spreadsheets/private/full
[content_type] => application/atom+xml; charset=UTF-8
[http_code] => 200
[header_size] => 1243
[request_size] => 231
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 1.05885
[namelookup_time] => 0.520259
[connect_time] => 0.529659
[pretransfer_time] => 0.611242
[size_upload] => 0
[size_download] => 7786
[speed_download] => 7353
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 1.021271
[redirect_time] => 0
[redirect_url] => 
[primary_ip] => 212.51.211.41
[certinfo] => Array
    (
    )

[primary_port] => 443
[local_ip] => 192.168.0.1
[local_port] => 59361

但是当推送到AppEngine时,会返回以下内容:

[url] => https://spreadsheets.google.com/feeds/spreadsheets/private/full
[content_type] => 
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0.056215
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
[redirect_url] => 
[primary_ip] => 
[certinfo] => Array
    (
    )

[primary_port] => 0
[local_ip] => 
[local_port] => 0

为什么这不适用于生产中的AppEngine?我怀疑它与SSL证书有关。

我已设置以下参数:

PHP.ini中。 - extension =" curl.so" CURLOPT_SSL_VERIFYPEER设置为false。

$ requestSslContext [" cafile"] = dirname(FILE)。 ' /cacerts.pem' ;;在IO / Stream.php中注释掉了。

1 个答案:

答案 0 :(得分:4)

要实现这个目标:

在php.ini中 对于本地开发环境,请使用

extension = "curl.so"

对于生产环境,请使用

google_app_engine.enable_curl_lite = "1"