1

this is a simple function to upload files remotely via php to rapidshare, requires username and password and curl activated in your server.

where is global, you can set the username and password anywhere outside the function

  function upload_Rapidshare_remote($fileurl)
  {
        global $username, $password;

        //Define the variables for post
        $url        = 'http://rapidshare.com/cgi-bin/rsapi.cgi';
        $fields     = array('sub'        => "remotegets",
                             'cmd'       => "addjob",
                             'login'     => $username,
                             'password'  => $password,
                             'urls'      => urlencode($fileurl)
                          );

        //Create url for post data
        foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
        rtrim($fields_string, '&');

        //Open the Connection
        $ch = curl_init($url);

        //Send Post Data
        curl_setopt ($ch, CURLOPT_POST, 1);
        curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

        //Execute
        $result = curl_exec($ch);

        //Close the connection
        curl_close($ch);

        //return....
        return;
  }

Method of Use

upload_Rapidshare_remote('http://www.mysite.com/file.zip');
aleksander haugas
  • 93
  • 1
  • 2
  • 10

0 Answers0