Skip to content

Instantly share code, notes, and snippets.

@ayatmaulana
Created February 7, 2018 07:05
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 ayatmaulana/67634320c7dbb5d80ac2e1e7c1db7791 to your computer and use it in GitHub Desktop.
Save ayatmaulana/67634320c7dbb5d80ac2e1e7c1db7791 to your computer and use it in GitHub Desktop.
guzzleHttp example
use GuzzleHttp\Client;
Class IP {
public static function getIpInfo($ip)
{
$client = new Client();
$res = $client->request('GET', 'http://ip-api.com/json/'.$ip);
return (string) $res->getBody();
}
}
echo IP::getIPInfo( "43.252.11.213" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment