Php Curl İle Image Shacke Upload Sorunu
-
Baslikta belirttigim gibi, sunucudaki bi dosyayi php-curl kullanarak imageshacke upload etmeye calisiorm, malesef imageshack sunucusu cvp bile vermeye tenezzul etmior :P
<?php
function uploadToImageshack($filename) {
$ch = curl_init('http://www.imageshack.us/upload_api.php');
$post['fileupload']= '@'.$filename;
$post['email']= 'gver@gver.com';
$post['key']= '***************';
$post['rembar']= 'yes';
$post['optsize']= '96x96';
$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
}
}
print uploadToImageshack("avi2.jpg");
?>$result bombos bi string malesef. :\
********* yazan yerde gecerli bi key var, sorun bundan deil.exampleyide caldim ama, imageshacktede asagidaki gibi aciklamislar.
- fileupload; (input type="file") - image or video file. Mandatory unless url parameter is specified.
- frmupload; (input type="file") - video default frame picture. Optional, used only for video upload. When you uploading your video you could supply a default frame that will be displayed when video is stopped. Dimensions of this image should be the same as video file's ones to avoid artefacts on screen.
- url; This parameter indicates that transload method is used instead of upload
- optsize; resize options for image in form WxH if image is uploaded/transloaded. No impact on video uploads.
- rembar; Developer could tell to ImageShack to leave/remove information bar on thumbnail image generated by ImageShack . If you've supplied this parameter as yes or as 1 then generated thumbmail will have no information bar. No impact on video uploads
- tags; A comma-separated list of tags to add to your video/image. E.g. family,picture. Optional
- public; Public/private marker of your video/picture. yes means public (default), no means private. Optional
- cookie; Registration code, optional.
- a_username; Username, optional.
- a_password; Password, optional.
- key; Your DeveloperKey. Mandatory.
fsock la fln degil illa curl kullanarak yapmak istiorm.Yokmu baba bi phpci :P.
-
fikri olan yokmu :\
-
print uploadToImageshack("avi2.jpg");
php dosyası ile resım dosyası aynı dızınde dımı ?
diğer turlu bır hata yok sanırsam :/
-
Allahım ya ayni dizinde olmasina ragmen yinede users/vs diye path belirtmek gerekiormus, cozuldu :)
-
hadı gozun aydın :)
