Re: PHP Google APIs Client: How to get user's location
| From: | Jeffry Killen | Date: | Mon, 15 Sep 2014 01:15:24 +0000 |
| Subject: | Re: PHP Google APIs Client: How to get user's location | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323868@lists.php.net to get a copy of this message | ||
On Sep 14, 2014, at 2:53 PM, Adam Tong wrote:
Hi, I implemented successfully a sign-in with google feature in my website. Now I want to retrieve the user's location after he signs in. How can I do that? At this moment here is the scope that i have: $client-setScopes('email');` I guess I have to change that. And to retrieve data I have the following: $client->verifyIdToken()->getAttributes(); Do I need another method than this? thanksHave you tried this? $_SERVER['HTTP_referer'] // page that the user is coming from if another web site page link $_SERVER['SRC_ADDRESS'] // clients source ip address, but this is probably a ISP's assigned address