Skip to content

Instantly share code, notes, and snippets.

@aaronpearce
Created August 8, 2011 23:20
Show Gist options
  • Save aaronpearce/1133023 to your computer and use it in GitHub Desktop.
Save aaronpearce/1133023 to your computer and use it in GitHub Desktop.
PHP Gallery/UserID Grabber
<?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