Webbased API
Tumbler
Posts: 323
Hi,
I'm working on a webbased API to generate images and searchin for some perl scripters (or other languages) for testing.
I can't test other scripts, only PHP. So it would be awesome if somebody can take a look at it and test it.
PS: there is no error handling used here (only testing for valid parameters)
To generate an image in php:
this will produce an image like this:

Thx in advance
I'm working on a webbased API to generate images and searchin for some perl scripters (or other languages) for testing.
I can't test other scripts, only PHP. So it would be awesome if somebody can take a look at it and test it.
PS: there is no error handling used here (only testing for valid parameters)
To generate an image in php:
<?php
// make a stdclass
$test = new stdclass;
$test->Vkey="dHVtYmxlcg==aWxzZTRtZQ==";
$test->width = 480;
$test->height = 272;
$test->title = 'This is the title of the image';
// encoded it with json
$encoded = json_encode($test);
//retrieve XML with simpleXML
$target = 'http://www.tumbler.be/api/?g=' . $encoded;
$xml_object = new SimpleXMLElement($target, NULL,true);
//test if we have an error
if (!empty($xml_object->error)) {
echo $xml_object->error;
}
else {
//show result
echo '<img src="'.$xml_object->image.'" />';
}
?>
this will produce an image like this:

Thx in advance

Comments