Created
November 9, 2014 18:08
-
-
Save yitsushi/2699b24bb590aef6db10 to your computer and use it in GitHub Desktop.
Google+ Post about it: https://plus.google.com/104695723888883478740/posts/MfBnVkqbeHH | Online version: http://folyam.info/google-play-activity.php
This file contains hidden or 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
| <?php | |
| if (array_key_exists('profileUrl', $_POST)) { | |
| $url = $_POST['profileUrl']; | |
| } else { | |
| $url = "https://plus.google.com/u/0/+SergeyBrin/posts"; | |
| } | |
| $url = preg_replace('/u\/\d+\//', '', $url); | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
| $response = curl_exec($ch); | |
| preg_match('/data:\["(\d+)",/', $response, $matches); | |
| $profileId = $matches[1]; | |
| preg_match('/<title itemprop="name">(.*) - Google\+<\/title>/', $response, $matches); | |
| $name = $matches[1]; | |
| echo "<h1>Google Play Activity: " . htmlentities($name) . "</h1>"; | |
| $url = 'https://play.google.com/store/people/details?id=' . $profileId; | |
| echo "<a href='" . $url . "' target='_blank'>" . $url . "</a>"; | |
| ?> | |
| <form method="post"> | |
| Profile URL: <input type="text" name="profileUrl" placeholder="Google+ Profile URL"> | |
| <input type="submit" value="Get the Activity URL"> | |
| </form> | |
| <h2>Examples:</h2> | |
| <ul> | |
| <li>https://plus.google.com/u/0/+SergeyBrin/posts</li> | |
| <li>https://plus.google.com/u/0/+YehudaKatz/posts</li> | |
| </ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment