3
votes

On local AppEngine, a curl request gives the following result which is what I expect.

[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

)

but when pushing to AppEngine, the following is returned:

[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

Any ideas as to why this isn't working on AppEngine in production? I suspect its something to do with the SSL certificates.

I've set the following parameters:

PHP.ini. - extension = "curl.so" CURLOPT_SSL_VERIFYPEER is set to false.

$requestSslContext["cafile"] = dirname(FILE) . '/cacerts.pem'; in IO/Stream.php is commented out.

1
cloud.google.com/appengine/docs/php/config/php_ini google_app_engine.enable_curl_lite = "1" might help - did you do that? - Paul Collingwood
Doesn't look like an SSL issue as I don't think it got that far. What does var_dump(curl_error($ch)); show? - drew010
@dre010 - it returns 0 (!) - XCode Warrier
@PaulCollingwood extension = "curl.so" works for local dev environment, google_app_engine.enable_curl_lite = "1" works for production. - XCode Warrier
I see you have it solved but cURL has a pretty archaic API. You should follow the docs for urlfetch and use that instead unless you absolutely need cURL cloud.google.com/appengine/docs/php/urlfetch - Josh J

1 Answers

4
votes

To get this working:

Within php.ini For the local dev environment, use

extension = "curl.so"

For the production environment, use

google_app_engine.enable_curl_lite = "1"