0

hello;

i dont know whether this is appropriate forum to ask this question, but after viewing some helping threads i decided to post mine problem and hope you guys will help me.

I am a blogger, i upload files and then monetize the links using adfly and linkbucks. But as you can see this is time consuming task.

I use multiup.org to upload files which has its API, and uses both adf.ly and linkbucks to monetize links and both has API too.

Now here is my scenerio...

A script which allow me to put url like http://file.com/video.avi , it upload the file to multiup.org and after successfully uploading the link get shrinked using adf.ly and then linkbucks.

Sorry for my bad english, i hope you will get the point.

2
Contributors
2
Replies
32
Views
3 Years
Discussion Span
Last Post by askfriends
1

You can use file_get_contents() to get the link contents, and curl to upload the file and receive the response. Here's a rough example:

<?php

$fast = json_decode(file_get_contents('http://www.multiup.org/api/get-fastest-server'));

if($fast->error !== 'success') die('Error!');

$url = file_get_contents('http://upload.wikimedia.org/wikipedia/commons/a/ac/SubtractiveColorMixing.png');
$tmpfile = tempnam("/tmp", "FOO");
$filearray = array('files[]'=>'@'.$tmpfile);

$handle = fopen($tmpfile, "w");
fwrite($handle, $url);
fclose($handle);

$file = array('files[]'=>'@'.$tmpfile);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$fast->server);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $filearray);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close ($ch);

$return = json_decode($result, true);

print_r($return);
echo $return[0]['url'] . PHP_EOL;

This will return an array, from this you can access to the download page:

echo $return[0]['url'];

An example of output:

Array
(
    [0] => Array
        (
            [name] => FOONS4eNq
            [hash] => 565aea34369244f52ab108c12f98300f
            [size] => 7276
            [type] => application/octet-stream
            [sid] => 
            [hashUpload] => 
            [md5] => .
            [sha] => .
            [user] => 
            [url] => http://www.multiup.org/download/565aea34369244f52ab108c12f98300f/FOONS4eNq
            [delete_url] => http://squeeze.multiup.org/upload/?file=FOONS4eNq
            [delete_type] => DELETE
        )

)

But this will not return the links of the mirrors, to get those you need an account and you have to use their Grabber utility:

I don't know if this works along with their API. If yes, then the response should return those links and from there you can use adf.ly and linkbucks APIs, I cannot test because I don't have an account in those services. Try to create it and if you have problems post your code here.

Docs:

0

thank u so much for your reply!
unfortunately i am not php expert so i dont understand anything, i just want to get script files to upload and start working... i am sorry if it sounds weird.
thank u once again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.