How Can I Upload to Rapidshare.com using PHP Script

Discussion in 'PHP' started by msmp3, Jul 30, 2007.

  1. #1
    Hello,

    I want to know if it's possible to upload a file to www.rapidshare.com using a PHP script that resides on my site and then retrieve the URL of the uploaded file?

    Rapidshare offers a script to do this, but it's written in Perl and I do not know this language at all.

    Does someone know how to make this work in PHP, or somehow integrate that Perl Script into PHP so it can upload/retrieve uploaded URL?

    I have attached the Perl Script offered by Rapidshare.
     

    Attached Files:

    msmp3, Jul 30, 2007 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use CURL to POST the file to rapidshare, then scrape the returned page for the information you need.

    Your php script might time out though, while the file is uploading.
     
    matthewrobertbell, Jul 30, 2007 IP
  3. msmp3

    msmp3 Peon

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Why do you say it will timeout? Isn't the same as if someone would upload a file on my site using PHP?
     
    msmp3, Jul 30, 2007 IP
  4. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ah yea, maybe.
    If it does timeout, you could always use set_time_limit().
     
    matthewrobertbell, Jul 30, 2007 IP
  5. madmax728

    madmax728 Banned

    Messages:
    620
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <form name="ul" method="post" action="http://rs97l3.rapidshare.com/cgi-bin/upload.cgi?rsuploadid=99619963777997544" enctype="multipart/form-data" onsubmit="document.ul.u.value='Please wait ...';document.ul.u.disabled=true">
    <a href="#" onclick="switchfiles()">Multi-Upload</a> Choose your upload-datapath: &nbsp;&nbsp;&nbsp; Cogent <input name="mirror" type="radio" onclick="document.ul.action='http://rs97cg.rapidshare.com/cgi-bin/upload.cgi?rsuploadid=99619963777997544';document.ul.u.value='Upload via Cogent'">
    Level(3) <input checked name="mirror" type="radio" onclick="document.ul.action='http://rs97l3.rapidshare.com/cgi-bin/upload.cgi?rsuploadid=99619963777997544';document.ul.u.value='Upload via Level(3)'">
    Telia <input name="mirror" type="radio" onclick="document.ul.action='http://rs97tl.rapidshare.com/cgi-bin/upload.cgi?rsuploadid=99619963777997544';document.ul.u.value='Upload via Telia'"><br>
    <div id="files"><input type="file" size="64" name="filecontent"> <input type="submit" name="u" value="Upload!"></div></form>
     
    madmax728, Jul 30, 2007 IP
  6. madmax728

    madmax728 Banned

    Messages:
    620
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    But the problem is
    This value rsuploadid=99619963777997544
    keeps on changing,
    So this method cannot be used.
     
    madmax728, Jul 30, 2007 IP
  7. Vbot

    Vbot Peon

    Messages:
    107
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Why not login to your rapidshare account then use remote upload instead.
     
    Vbot, Jul 30, 2007 IP
  8. msmp3

    msmp3 Peon

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I would like to do this automatically... this is why Remote Upload option is not suitable....
     
    msmp3, Aug 12, 2007 IP
  9. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Well,
    You would have to first fetch the Upload page ( In this case http://rapidshare.com/ )using Curl. Parse the page using regular expressions to find that unique submit url using the
    preg_match
    PHP:
    function. Then POST the file to that page.

    ~
    Thomas
     
    coderlinks, Aug 12, 2007 IP
  10. msmp3

    msmp3 Peon

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I'm going to try something like @coderlinks said... see if it works :)
     
    msmp3, Sep 22, 2007 IP
  11. kuno2011

    kuno2011 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    how about megaupload? anyone knows how?

    thanks
     
    kuno2011, Mar 13, 2010 IP
  12. d2loot

    d2loot Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    thanks I was just looking up info on how to do this then stumbled across this site
     
    d2loot, Mar 13, 2010 IP
  13. hadelnasr

    hadelnasr Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    That was great man , but please can anyone help me to do the same thing but now with those hosting sites :

    1) FileDude.com
    2) FileApe.com
    3) zShare.net
    4) Mediafire.com
    5) 2shared.com
    6) Rocketfile.net
     
    hadelnasr, Dec 4, 2010 IP