vince2doom
12-11-2008, 10:18 AM
[PHP] Imageshack upload api
Hey guys !
I've started my own website and I want them to upload their pictures trough the api on my website. All of this works but now I want to add the user uploads to my account on imageshack.
I've already contacted imageshack but the only reaction I get is this:
Quote:
Vince,
There should be a parameter used to pass user cookies, which is a registration code.
Then I found this on the website:
Quote:
Uploading into Accounts
If a user specifies a valid registration code, the uploaded images will populate a user's Image Panel.
Instruct a registered and logged-in user to retrieve his or her registration code by visiting the Registration page. If the user has a registration cookie on his computer, the registration code can then be copied and pasted with ease.
To validate a user's registration code input, send the following variables via GET or POST to http://reg.imageshack.us/setlogin.php
login; (the registration code)
xml = "yes"; (specifies the return of XML)
My code:
PHP Code:
function uploadToImageshack($filename) {
テつ*テつ*テつ*テつ*テつ*テつ*テつ*$ch = curl_init('http://www.imageshack.us/upload_api.php');
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['fileupload']テつ*テつ*テつ*テつ*= '@'.$filename;
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['email']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= 'email@here.be';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['key']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= '*****************';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['rembar']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= 'yes';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['optsize']テつ*テつ*テつ*テつ*= '96x96';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['login']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= '*****************';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['xml']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= 'yes';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_POST, true);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_HEADER, false);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_TIMEOUT, 240);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$result = curl_exec($ch);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_close($ch);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*if (strpos($result, '<'.'?xml version="1.0" encoding="iso-8859-1"?>') === false) {
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*return 'failed';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*} else {
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*return $result; // XML data
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*}
テつ*テつ*テつ*テつ*}
My question is can someone help me to add the pictures to my account ?
thanks in advance !!
Hey guys !
I've started my own website and I want them to upload their pictures trough the api on my website. All of this works but now I want to add the user uploads to my account on imageshack.
I've already contacted imageshack but the only reaction I get is this:
Quote:
Vince,
There should be a parameter used to pass user cookies, which is a registration code.
Then I found this on the website:
Quote:
Uploading into Accounts
If a user specifies a valid registration code, the uploaded images will populate a user's Image Panel.
Instruct a registered and logged-in user to retrieve his or her registration code by visiting the Registration page. If the user has a registration cookie on his computer, the registration code can then be copied and pasted with ease.
To validate a user's registration code input, send the following variables via GET or POST to http://reg.imageshack.us/setlogin.php
login; (the registration code)
xml = "yes"; (specifies the return of XML)
My code:
PHP Code:
function uploadToImageshack($filename) {
テつ*テつ*テつ*テつ*テつ*テつ*テつ*$ch = curl_init('http://www.imageshack.us/upload_api.php');
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['fileupload']テつ*テつ*テつ*テつ*= '@'.$filename;
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['email']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= 'email@here.be';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['key']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= '*****************';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['rembar']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= 'yes';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['optsize']テつ*テつ*テつ*テつ*= '96x96';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['login']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= '*****************';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$post['xml']テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= 'yes';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_POST, true);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_HEADER, false);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_TIMEOUT, 240);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*$result = curl_exec($ch);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*curl_close($ch);
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*if (strpos($result, '<'.'?xml version="1.0" encoding="iso-8859-1"?>') === false) {
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*return 'failed';
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*} else {
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*return $result; // XML data
テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*}
テつ*テつ*テつ*テつ*}
My question is can someone help me to add the pictures to my account ?
thanks in advance !!
