samedi 27 octobre 2018

Guzzle Returning Stream?

I have this:

private function logSearch($term)
    {
        $geo_data = $this->geoIP($ip);
        dd($geo_data);
    }

public function geoIP($ip)
    {
        $url = "http://api.ipstack.com/$ip?access_key=" . env('GEOIP_KEY');    
        $response = $this->client->request('GET', $url);
        return $response->getBody();
    }

The response should be:

{"ip":"78.63.56.237","type":"ipv4","continent_code":"EU"...etc}

But instead I am getting:

Stream {#482
  -stream: stream resource @290
    wrapper_type: "PHP"
    stream_type: "TEMP"
    mode: "w+b"
    unread_bytes: 0
    seekable: true
    uri: "php://temp"
    options: []
  }
  -size: null
  -seekable: true
  -readable: true
  -writable: true
  -uri: "php://temp"
  -customMetadata: []
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2JiPD6A
via IFTTT

Aucun commentaire:

Enregistrer un commentaire