http://hosting.hentaiguru.com/api.phpwith your parameters. (see below)
| PARAMETER | VALUES | DESCRIPTION | REQUIRED |
| method | [post/url] | Use post or url for image data. POST: Upload data from post. Name your data field 'image'. URL: use url param. | Yes |
| url | - | Url to remote image if method=url | Only if method=url |
| thumb | [0/100/200/300] | Thumb size you want, default:0 | No |
| color | [w/g/b/u/n/r/p/o/i] | Background color for viewer page. Colors are: w => White g => Gray b => Black u => Blue n => Green r => Red p => Pink o => Orange i => The official Hentai Guru pattern default:w | No |
| name | - | Name for your image to use instead of the filename | No |
{
"status": "ok",
"image": "http:\/\/hosting.hentaiguru.com\/view\/w\/f05dacd01224194g\/hosting.gif",
"name": "hosting",
"extension": ".gif",
"thumbnails": {
"300": {
"url": "http:\/\/hosting.hentaiguru.com\/thumb\/f05dacd01224194g300\/hosting.jpg",
"w": 200,
"h": 200
}
}
}
{
"status": "error",
"error_code": "error_invalid_url",
"error_msg": "URL is invalid or site does not exist."
}
hxxp://hosting.hentaiguru.com/api.php?method=url&url=http://hosting.hentaiguru.com/hosting.png&color=u&thumb=200
<?php
/* Uploading POST data to the API */
$filename = 'image.jpg'; //want to upload this image
$post = array();
$post['file'] = "@".$filename;
//execute curl request
$url = 'http://hosting.hentaiguru.com/api.php?method=post&thumb=200';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
//parse response
$decode = json_decode($response);
$image = $decode->image;
$thumbnail = $decode->thumbnails->{200}->url;
//display it as a clickable thumb
echo "<a href='{$image}'><img src='{$thumbnail}' /></a>";
?>
<?php
/* Simple method to upload image from an URL. */
// URL to the image we want to upload
$url = 'http://hosting.hentaiguru.com/hosting.png';
//Call the API
$api = "http://hosting.hentaiguru.com/api.php?method=url&url=$url"; //
$response = file_get_contents($api);
//Response
$json = json_decode($response);
if($json->status == 'ok') {
//We have the image, now we can save it to our database etc.
echo $json->image;
} elseif($json->status == 'error') {
//There was an error
echo $json->error_msg;
}
?>