cURL help needed.!!

Discussion in 'PHP' started by shubhamjain1, Mar 11, 2009.

  1. #1
    I have made a cURL script to remotely upload to rapidshare but it is just is'nt working. I am getting a blank page.!!

    
    <?php
    
    function cURL($url,$header,$cookie,$p) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_COOKIE, $cookie);
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        if($p){
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $p);
        };
    
        $result = curl_exec($ch);
      
    
        if($result){
            return $result;
        }else{
           return curl_error($ch);
        };
    	  curl_close($ch);
    };
    
    echo cURL("http://rs250gc.rapidshare.com/cgi-bin/upload.cgi?rsuploadid=9961252676201783",null,"user=c3797241-*******","freeaccountid=3797241&password=*****&filecontent=@E:\\xampp\\htdocs\\imgresize.zip");
    
    ?>
    
    Code (markup):
     
    shubhamjain1, Mar 11, 2009 IP
  2. mighty_falcon

    mighty_falcon Member

    Messages:
    67
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #2
    You are trying to echo the contents of a zip file? What is the page that you are trying to echo have? What are its contents?
     
    mighty_falcon, Mar 12, 2009 IP
  3. shubhamjain1

    shubhamjain1 Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i m trying to upload a zip file.!!! if you know "@" sign directs curl to send the file.!!!

    i have used echo to show status.!!
     
    shubhamjain1, Mar 13, 2009 IP
  4. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Does the web server have read access to E:\\xampp\\htdocs\\imgresize.zip ?
     
    SmallPotatoes, Mar 13, 2009 IP
  5. shubhamjain1

    shubhamjain1 Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I running on localhost [XAMPP]
     
    shubhamjain1, Mar 13, 2009 IP
  6. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Nevertheless it's worth checking since it will take about 10 seconds (is_readable()...).

    Also, explicitly check your $cookie to see if it is what the server is expecting.
     
    SmallPotatoes, Mar 13, 2009 IP
  7. shubhamjain1

    shubhamjain1 Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    if replace url with any other page of rapidshare it shows the contents which means rapidshare is accepting cookie but the problem seems to be in uploading.!!!
     
    shubhamjain1, Mar 13, 2009 IP