Codejungle - Open API
Example:
Parameter
url (string)
size (string) large or crop default large
Shell
shell> curl -d 'size=crop&url=http://www.google.com' http://www.codejungle.org/api/thumb.php
PHP
<?
/**
* Website Thumbnail
* creates a thumbnail of given url
*
* @param $url string
* @param $size string optional could be large or crop
*
* @return string url of generated thumbnail
*
* @author andreas beder <office@codejungle.org>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
**/
function website_thumbnail($url, $size){
$Curl_Session = curl_init("http://www.codejungle.org/api/thumb.php");
curl_setopt ($Curl_Session, CURLOPT_POST, 1);
curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "url=$url&size=$size");
curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($Curl_Session, CURLOPT_RETURNTRANSFER, 1);
$response=curl_exec($Curl_Session);
curl_close ($Curl_Session);
$xml=simplexml_load_string($response);
return $xml;
}
?>
Response
<?xml version="1.0"?>
<!DOCTYPE result SYSTEM "http://codejungle.org/api/thumb.dtd">
<result>http://www.codejungle.org/api/thumb/xxx.jpg</result>
Another method via get method:
http://codejungle.org/api/thumb_get.php?url=http://www.google.com
Now a Python QT Gui is also avaible: Screenshot | Download
Example:
Shell
shell> curl -F 'face=@localfilename' http://www.codejungle.org/api/face.php
PHP
<?
/**
* Face detection
*
*
* @param $image string should be the path to your jpeg
*
* @return string xml output of my api
*
* @author andreas beder <office@codejungle.org>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
**/
function face_detection($image){
$data = array("face" => "@".$image);
$Curl_Session = curl_init("http://www.codejungle.org/api/face.php");
curl_setopt ($Curl_Session, CURLOPT_POST, 1);
curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, $data);
curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($Curl_Session, CURLOPT_RETURNTRANSFER, 1);
$response=curl_exec($Curl_Session);
curl_close ($Curl_Session);
return $response;
}
?>
Parameter
face (jpg image)
Response
<?xml version="1.0"?>
<!DOCTYPE face SYSTEM "http://codejungle.org/api/face.dtd">
<face>
<found>yes</found>
<image>http://www.codejungle.org/api/face/xxxx.png</image>
</face>
Example:
Parameter
plz
umkreis (km)
land (de,at,ch)
http://codejungle.org/api/plz?plz=23747&umkreis=5&land=de
Example:
Parameter
ip
format (string) optional could be json, default is xml
Shell
shell> curl -d 'ip=78.41.112.52' http://www.codejungle.org/api/geoip.php
Response
<?xml version="1.0"?>
<!DOCTYPE geoip SYSTEM "http://codejungle.org/api/geo.dtd">
<geoip>
<country_code>AT</country_code>
<country_code3>AUT</country_code3>
<country_name>Austria</country_name>
<region>09</region>
<city>Vienna</city>
<postal_code></postal_code>
<latitude>48.2000007629</latitude>
<longitude>16.3666992188</longitude>
<dma_code>0</dma_code>
<area_code>0</area_code>
</geoip>
What should i do if something goes wrong?
Make sure your Parameters are url encoded.
Make sure you use the right Parameters and post method
Only for facedetection:
Make sure your image is a jpeg
How works the Website Thumbnailer
I use cutycapt for that.
How works the Facedetection?
I use the opencv lib to detect faces
How works the GeoIP?
I use Maxmind Geolitecity
Why is it so slow?
It can take up to 30 sec to process a request.
If you need a faster soloution, contact me.
How much does it cost ?
Nothing.
Do i need an API Key ?
No
How can i contact you?
office@codejungle.org
Changelog
08.06.2010 Added ZIP radius search
27.04.2010 Python QT GUI for Website Thumbnailer (thx 2 mario from unite-it.at)
02.03.2010 Added json output and dtd for geoip
18.02.2010 Added GEOIP
04.11.2009 Updated dokumentation (added php examples)
03.11.2009 Fixed major bug in Facedetection.
02.11.2009 Added variable size to website thumnailer with parameter crop or large, default is large.
Powered by
www.codejungle.org