Skip to content

Instantly share code, notes, and snippets.

@kimpepper
Created March 25, 2014 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimpepper/9756773 to your computer and use it in GitHub Desktop.
Save kimpepper/9756773 to your computer and use it in GitHub Desktop.
<?php
/**
* Finds the host IP address by calling the httpbin web service.
*
* @return string
* The current hosts IP address.
*/
function guzzle_example_get_host_ip() {
$client = new \GuzzleHttp\Client();
$response = $client->get('http://httpbin.org/get');
$json = $response->json();
return $json['origin'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment