Created
August 8, 2011 23:20
-
-
Save aaronpearce/1133023 to your computer and use it in GitHub Desktop.
PHP Gallery/UserID Grabber
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(isset($_GET['username'])) { | |
$username = $_GET['username']; | |
$userpage = file_get_contents("http://" . $username . ".deviantart.com"); | |
$first = explode("gruserid=", $userpage); | |
$parts = explode(">",$first[1]); | |
$id = $parts[0]; | |
} elseif(isset($_GET['id'])) { | |
$id = $_GET['id']; | |
} else { | |
echo "No ID set."; | |
} | |
echo "User ID is " . $id . "<br/>"; | |
$file = json_decode(file_get_contents("http://deviantart.com/global/difi.php?c[]=Aggregations;get_galleries_initial;".$id.",20,1&t=json"))->DiFi->response->calls[0]->response; | |
//print_r($file); | |
foreach($file->content as $key) { | |
echo "<b>" . $key->title . "</b> - " . $key->galleryid . "<br/>"; | |
foreach($key->ids as $ids) { | |
$url = "http://backend.deviantart.com/oembed?url=http://www.deviantart.com/deviation/".$ids[2]; | |
$json = @json_decode(file_get_contents($url)); | |
if($json) { | |
echo $json->title ."<br/>"; | |
} else { | |
echo "Error!<br/>"; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment