Results 1 to 4 of 4
-
9th Feb 2012, 01:07 PM #1OPMemberWebsite's:
satiq.netUpload image to PixHost
Hi,
can anyone tell me how can I upload image to pixhost.org with Curl?
Thanksskinner Reviewed by skinner on . Upload image to PixHost Hi, can anyone tell me how can I upload image to pixhost.org with Curl? Thanks Rating: 5
-
9th Feb 2012, 02:26 PM #2MemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comPHP Code:function upload_to_pixhost($img,$safe=0) {
$imageUrl = '';
$pvars = array('img[]'=>"@".$img,'content_type'=>$safe,'tos'=>'on');
$page = get_page('http://www.pixhost.org/classic-upload/',$pvars,'','http://www.pixhost.org/classic-upload/');
//echo '<textarea>'.htmlentities($page).'</textarea>';
preg_match('~<div class="linksleft">Forum thumbnail:</div>\s+<div class="linksright"><input type="text" style="width:500px" onclick="javascript:highlight\(this\);" readonly="readonly" value="(.*?)"/></div>~',$page,$match);
//print_r($match);
$imageUrl = $match[1];
if(stristr($imageUrl,'pixhost.org')) return $imageUrl;
else return '';
}
$img = 'D:\Ampps\www\test\0001.jpg';
echo upload_to_pixhost($img);
-
9th Feb 2012, 03:02 PM #3OPMemberWebsite's:
satiq.netit says:
Code:Could not connect to host: http://www.pixhost.org/classic-upload/
-
9th Feb 2012, 03:30 PM #4OPMemberWebsite's:
satiq.netI've resolt..
I write that code:
PHP Code:$imgpath = "/some/file/in/some/directory.jpg"
$agent= "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14";
$reffer= "http://www.pixhost.org/classic-upload/";
$cookie_file_path = 'files/cookie.txt';
$fp1 = fopen($cookie_file_path,'wb');
if(!$fp1)
echo 'error opening cookie file';
fclose($fp1);
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_URL,"http://www.pixhost.org:8080/classic-upload/");
curl_setopt($ch1, CURLOPT_USERAGENT, $agent);
curl_setopt($ch1, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch1, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch1, CURLOPT_REFERER, "");
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, 1);
$html1 = curl_exec($ch1);
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_URL, 'http://www.pixhost.org:8080/classic-upload/"');
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch1, CURLOPT_REFERER,$reffer);
curl_setopt($ch1, CURLOPT_POST, 1);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch1, CURLOPT_USERAGENT, $agent);
curl_setopt($ch1, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch1, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION,1);
$postResult = curl_exec($ch1);
$data1 = array('content_type' => '1', 'img[]' => '@'.$imgpath,'tos'=>'on');
curl_setopt($ch1, CURLOPT_URL, 'http://www.pixhost.org:8080/');
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch1, CURLOPT_REFERER,'http://www.pixhost.org:8080/classic-upload/');
curl_setopt($ch1, CURLOPT_POST, 1);
curl_setopt($ch1, CURLOPT_POSTFIELDS, $data1);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_COOKIESESSION, true);
curl_setopt($ch1, CURLOPT_USERAGENT, $agent);
curl_setopt($ch1, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch1, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION,1);
$postResult = curl_exec($ch1);
if (curl_errno($ch1)) {
print curl_error($ch1);
}
curl_close($ch1);
//print $postResult
preg_match('~<div class="linksleft">HTML thumbmail:</div>\s+<div class="linksright"><input type="text" style="width:500px" onclick="javascript:highlight\(this\);" readonly="readonly" value="(.*?)"/></div>~',$postResult,$match);
//print_r($match);
$imageUrl = $match[1];
if(stristr($imageUrl,'pixhost.org')) echo $imageUrl;
else return '';
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
PHP CURL Problem with Pixhost.org
By heppinnz in forum Web Development AreaReplies: 6Last Post: 20th Jun 2012, 05:10 PM -
Image upload script
By rayzen921 in forum Web Application/Script SupportReplies: 3Last Post: 11th Mar 2012, 06:17 PM -
[Selling] PixHost.in $1 (Site + Domain)
By RNBxBeatz in forum Completed TransactionsReplies: 17Last Post: 6th Jul 2011, 02:23 PM -
[Selling] freepicbay.org copy pixhost.org, php,mysql, images
By jessepure in forum Completed TransactionsReplies: 0Last Post: 12th May 2011, 09:50 PM -
Script to upload images to pixhost or imag
By indahouse in forum Web Development AreaReplies: 2Last Post: 14th Feb 2011, 01:30 PM
themaCreator - create posts from...
Version 3.47 released. Open older version (or...