I am trying to use YFrog’s API. I think I am using it correctly to try and send a HTTP POST request that is of content type XML. However, as the response body, I am always getting a 404 error for some reason. Here is their API.
Here is my attempt of PHP code to upload.
$data = array('media' => 'http://img253.imageshack.us/my.php?image=bfab82a545d414uo.jpg', 'username' => 'asc',
'password' => 'asc', 'message' => 'hi');
$url = 'http://example.com/api/uploadAndPost';
$req = new HTTPRequest($url);
$req->addHeaders(array("Content-Type" => "text/xml"));
$req->setMethod(HTTP_METH_POST);
$req->addQueryData($data); $req->send();
echo $req->getResponseBody();
Also for the media it says “Binary image data” does that mean a URL of the image location can not be passed to it? What does it mean?
I think that the problem is basically that ImagesHack does not return a binary file when you give the URL posted above. For me, it returns an HTML document.
I think you should try passing a binary file as the “media” parameter. The photo that your trying to get is located at http://img253.imageshack.us/img253/172/bfab82a545d414uo.jpg, use this URL instead.
This is the response that I get with the one you originally tried: