Git Product home page Git Product logo

Comments (21)

Prefinem avatar Prefinem commented on May 29, 2024 2

cURL is now allowed on GAE. In your app.yaml file you need this:

runtime: php55

Then you will need to create a php.ini file in your root directory with the line

extension = "curl.so"

See here: https://cloud.google.com/appengine/docs/php/#dynamically_loadable_extensions

You will need to enable billing

from pusher-http-php.

ajessup avatar ajessup commented on May 29, 2024

Google App Engine supports http streams (which uses urlfetch() under the hood). So commands like file_get_contents() and fopen() will work.

from pusher-http-php.

ewwink avatar ewwink commented on May 29, 2024

urlfetch in php (file_get_contents) https://developers.google.com/appengine/docs/php/urlfetch/

from pusher-http-php.

leggetter avatar leggetter commented on May 29, 2024

See: #14

from pusher-http-php.

dvhirst avatar dvhirst commented on May 29, 2024

It seemed as of late last year (2013) that GAE developers were headed toward providing cURL functions within GAE (ref: https://code.google.com/p/googleappengine/issues/detail?id=9343). Now it is nearly a year later, but there is no update on the status of this issue. Closing this issue by providing cURL functionality in GAE would make life much easier for many folks. Is there a way to increase the attention to this issue?

from pusher-http-php.

ajessup avatar ajessup commented on May 29, 2024

(disclaimer, I work on the GAE PHP team)

Starring the issue is a great way to signal it's importance. cURL support is still very much on the roadmap, even if we've been a little quiet this year.

That said, any reason this implementation focuses on cURL rather than streams?

from pusher-http-php.

dvhirst avatar dvhirst commented on May 29, 2024

It seems many php projects use the curl library; the ability to use existing projects without tearing into their internal functionality is key to my ability to support my organization. I have the ability to understand what's going on, but changing project internals feels a bit risky to me, and would require investment of more time and effort than I can give as a volunteer resource.

from pusher-http-php.

mtdowling avatar mtdowling commented on May 29, 2024

@ajessup cURL is one of the most popular PHP extensions and is used in hundreds of projects on Packagist (for example, cURL is the default HTTP handler for Guzzle). Developers often choose cURL over PHP's stream wrapper because cURL offers far more flexibility and performance (e.g., persistent connections).

from pusher-http-php.

Prefinem avatar Prefinem commented on May 29, 2024

@ajessup while I can see streams being very useful, I can't help but fully agree with @mtdowling on this. In so many of my projects, I find using cURL much more enjoyable, flexible and powerful not to mention the huge list of libraries that already rely on cURL

from pusher-http-php.

mtdowling avatar mtdowling commented on May 29, 2024

It should also be noted that the Google App Engine stream wrapper implementation doesn't appear to support using a custom CA bundle (or any ssl context option other than "verify_peer"): https://cloud.google.com/appengine/docs/php/urlfetch/

There are a few considerations to keep in mind when using these wrappers in your Google App Engine application:

  • When connecting to web sites using HTTPS, the default behavior is to validate the certificate of the host and reject requests where the vertificate does not match. This is the opposite to the default behavior of PHP, and to change this behavior you can set the value of verify_peer to false in the ssl section of the context parameters.
  • All other values of ssl contexts options are ignored.

This makes an even stronger case for adding cURL support. But even if support cURL is added, the other ssl context options should be supported.

from pusher-http-php.

dvhirst avatar dvhirst commented on May 29, 2024

Folks, this issue has caused me to stop my work to implement CiviCRM /
WordPress on GAE. I've spent the past couple of days (not weeks and
months) implementing the same (actually newer and better) configuration on
Amazon Web Services, and it has gone very smoothly so far. I'd really
rather be on Google, but it just hasn't worked. FWIW, YMMV.

Regards,

Don Hirst

On Thu, Jan 15, 2015 at 2:33 PM, Michael Dowling [email protected]
wrote:

It should also be noted that the Google App Engine stream wrapper
implementation doesn't appear to support using a custom CA bundle (or any
ssl context option other than "verify_peer"):
https://cloud.google.com/appengine/docs/php/urlfetch/

There are a few considerations to keep in mind when using these wrappers
in your Google App Engine application:

  • When connecting to web sites using HTTPS, the default behavior is to
    validate the certificate of the host and reject requests where the
    vertificate does not match. This is the opposite to the default behavior of
    PHP, and to change this behavior you can set the value of verify_peer to
    false in the ssl section of the context parameters.

  • All other values of ssl contexts options are ignored.

    This makes an even stronger case for adding cURL support. But even if
    support cURL is added, the other ssl context options should be supported.

โ€”
Reply to this email directly or view it on GitHub
#13 (comment)
.

from pusher-http-php.

Neira1991 avatar Neira1991 commented on May 29, 2024

I am developing a mobile app on Google app engine, and it has been difficult to implement gcm, the community recommends "urlfetch" but will that urlfetch can replace curl to gcm on Google App engine?

from pusher-http-php.

dvhirst avatar dvhirst commented on May 29, 2024

Another six months have passed with no action on this topic. Is Google going to address cURL or not?

from pusher-http-php.

dvhirst avatar dvhirst commented on May 29, 2024

Thanks for this information. I'll follow up on it.

from pusher-http-php.

Prefinem avatar Prefinem commented on May 29, 2024

Yup, no worries. Just a heads up. After enabling the billing, it will take a bit for it to be activated. I usually wait an hour or so before testing it.

from pusher-http-php.

scripthead avatar scripthead commented on May 29, 2024

This still doesn't seem to work. I have billing enabled on the project and the following in app.yaml

runtime: php55

and this in php.ini

extension = "curl.so"

and the script

$ch = curl_init('http://google.com/');
$response = curl_exec($ch);
echo '<pre>' . print_r(curl_getinfo($ch),1);
echo '<pre>' . print_r(curl_error($ch),1);
echo '<pre>' . print_r($response,1);
die;

but it produces the following output:

Array
(
    [url] => http://google.com/
    [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.047984
    [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
)

notice the content type and http code are empty. On a local environment the same code produces

Array
(
    [url] => http://google.com/
    [content_type] => text/html; charset=UTF-8
    [http_code] => 302
    [header_size] => 234
    [request_size] => 49
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.157038
    [namelookup_time] => 0.068574
    [connect_time] => 0.112838
    [pretransfer_time] => 0.112901
    [size_upload] => 0
    [size_download] => 262
    [speed_download] => 1668
    [speed_upload] => 0
    [download_content_length] => 262
    [upload_content_length] => 0
    [starttransfer_time] => 0.156984
    [redirect_time] => 0
    [redirect_url] => http://www.google.com.ua/?gfe_rd=cr&ei=CnMNVuyVAqWG8Qe0pJLICQ
    [primary_ip] => 173.194.112.14
    [certinfo] => Array
        (
        )

    [primary_port] => 80
    [local_ip] => 192.168.0.3
    [local_port] => 53909
)

from pusher-http-php.

Prefinem avatar Prefinem commented on May 29, 2024

Did you set a billing limit?

from pusher-http-php.

scripthead avatar scripthead commented on May 29, 2024

I have billing limited to $50/day and haven't used over $2 in the last week.

from pusher-http-php.

Prefinem avatar Prefinem commented on May 29, 2024

http://terrenceryan.com/blog/index.php/php-on-app-engine-does-curl/

cURL is limited by the restrictions of App Engineโ€™s sockets but include:

  • Limited from targeting Google domains
  • May be reclaimed after 2 minutes of inactivity

Try calling a different domain instead of Google

from pusher-http-php.

scripthead avatar scripthead commented on May 29, 2024

That did it! Thank you.

from pusher-http-php.

Prefinem avatar Prefinem commented on May 29, 2024

No problem!

from pusher-http-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.