lundi 28 novembre 2016

guzzle http return 504 Gateway Time-out

I try to communicate with api and it always return me 504 Gateway Time-out. I try 'get' http request in jQuery in ajax and it works fine. Here is my code:

$.ajax({
    type:'GET',
    url: 'http://example.com',
    success:function(data){
        console.log(data);
    }
});

However, the problem is when I use to call this 'get' http request from php by guzzle. I try something like this:

$this->client = new Client();

$result = $this->client->request('GET', 'http://example.com');

return $result->getStatusCode();

This doesn't work.It always return me 504 Gateway Time-out. Do you know what wrong happened? When i type url for example 'http://google.com' instead of 'http://example.com it works fine by jQuery and also by Guzzle php.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire