Created
February 7, 2018 07:05
-
-
Save ayatmaulana/67634320c7dbb5d80ac2e1e7c1db7791 to your computer and use it in GitHub Desktop.
guzzleHttp example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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