Results 1 to 10 of 72
-
10th Mar 2011, 11:39 AM #1OPYou can call me G
Uploading to FileSonic Using cURL
Announced in CB to release it and here it is.
Note: It is NOT for sBorg or phpUploader or Yawn's Script! It's in cURL and since those scripts use cURL to upload, you can get an idea how to port it to one of the scripts mentioned above. Without any delay, here we go:
PHP Code:function uploadFiSO($x){
if(!file_exists(dirname(__FILE__).'\fisocookie.txt'))
{
//Login if there is no cookie
$val = postHost("http://www.filesonic.in/user/login", "email=$username&redirect=%2F&password=$password","", 'fisocookie.txt');
}
$cook = file_get_contents('fisocookie.txt');
preg_match('/PHPSESSID.*/', $cook, $match);
$sessionID = trim(str_replace('PHPSESSID', '', $match[0]));
$millisec = round((microtime(true) * 1000.0));
$random = rand(0,90000);
$url = 'http://s115.filesonic.in/?X-Progress-ID=upload_'.$millisec.'_'.$sessionID.'_'.$random;
$post = array('upload[]' => "@$x");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, trim($url));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'\fisocookie.txt');
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //Damn HTTP Error 417
$result = curl_exec($ch);
if(curl_errno($ch)){
echo "ERROR - " . curl_error($ch);
}
curl_close($ch);
$result = postHost('http://www.filesonic.in/upload-completed/upload_'.$millisec.'_'.$sessionID.'_'.$random, '',dirname(__FILE__).'\fscookie.txt');
preg_match('/F[0-9]+/', html_entity_decode($result), $match);
echo 'http://www.filesonic.com/file/'.str_replace('F','',$match[0]).'/'.$x;
}
function postHost($url, $data, $cookie, $storCook = null){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($cookie != "")
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
if($data != ""){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
if(isset($storCook)){
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'\\'.$storCook);
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'\\'.$storCook);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
$page = curl_exec($ch);
curl_close($ch);
return $page;
}
Usage: Copy paste the code above in a PHP file and then call it like this
PHP Code:uploadFiSO('/path/to/file');
gunda316Gaurav Reviewed by Gaurav on . Uploading to FileSonic Using cURL Announced in CB to release it and here it is. Note: It is NOT for sBorg or phpUploader or Yawn's Script! It's in cURL and since those scripts use cURL to upload, you can get an idea how to port it to one of the scripts mentioned above. Without any delay, here we go: function uploadFiSO($x){ if(!file_exists(dirname(__FILE__).'\fisocookie.txt')) { //Login if there is no cookie $val = postHost("http://www.filesonic.in/user/login", Rating: 5
My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz
-
10th Mar 2011, 11:42 AM #2BannedWebsite's:
Khambaty.com iMotivate.netAwseome , WIl it work wid RL ? coz Its cURL based I guess so ?
-
10th Mar 2011, 11:43 AM #3Banned
New RL versions now uses file get contents I guess
-
10th Mar 2011, 11:44 AM #4OPYou can call me G
@Netguy: It won't work in RL.. RL doesn't use cURL afaik..
My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz
-
10th Mar 2011, 11:47 AM #5BannedWebsite's:
Khambaty.com iMotivate.net@gunda - Do you know Javascript ?
-
10th Mar 2011, 11:47 AM #6Banned
@Gunda come on gtalk need to talk
-
10th Mar 2011, 11:53 AM #7OPYou can call me G
@Netguy: knew enough JavaScript to find out how FSC generated random numbers always had in mind I had to look for time function.
My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz
-
10th Mar 2011, 12:07 PM #8Member
Thanks a lot for the script.
-
10th Mar 2011, 01:45 PM #9Member
Thanks a billion
-
10th Mar 2011, 01:47 PM #10OPYou can call me G
you're welcome
My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[help] Uploading images to imageporter with curl
By hover in forum Web Development AreaReplies: 3Last Post: 23rd Apr 2011, 10:23 PM -
Help with Uploading.com batch Link Checker and Curl ..
By Lock Down in forum Webmaster ResourcesReplies: 9Last Post: 3rd Dec 2010, 02:31 AM -
[linux] Uploading to FileServe via curl
By Snell in forum Tutorials and GuidesReplies: 0Last Post: 19th Jun 2010, 12:52 PM -
[guide] Uploading to Hofile using curl
By desiboy in forum Tutorials and GuidesReplies: 19Last Post: 30th May 2010, 07:40 PM
themaCreator - create posts from...
Version 3.24 released. Open older version (or...