Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: cURL

  1. #1
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    cURL

    Please debug and correct my misstakes:

    http://pastebin.com/m32e38cf

    curl_setopt($ch, CURLOPT_INFILESIZE, $_FILES['upfile']['size']);
    Makes it load forever.
    Last edited by galaxyAbstractor; 12-15-2008 at 03:34 PM.

  2. #2
    vol7ron's Avatar
    vol7ron is offline x10 Lieutenant vol7ron is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    DC
    Posts
    434

    Re: cURL

    yeah with that information... im not sure anyone is going to help.
    If you find my post useful please add to my reputation by clicking the +Rep button
    You may also use the Donate link to donate credits - this is appreciated too Thanks to those whom have donated so far!


  3. #3
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: cURL

    Well. I want to be able to do a remote fileupload script to my filehost at http://datashelf.net.

    Basically, the form is on another server, and the file should be sent to http://datashelf.net/upload.php and handeled.

  4. #4
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: cURL

    Ok I edited a bit and managed to get some reactions:

    PHP Code:
    <html>
    <head>
    </head>
    <body>
    <?

    if (!isset($_POST['file'])){
        
    ?>
    <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="form"  method="post" style="display: inline;">
        Max filesize: <b>100 MB</b><br />
             <table border=0 cellspacing=0 cellpadding=2><tr><td align=center colspan=2>
         <input type="file" name="upfile" size="50" style="background-color:#EEE" /></td></tr>
             <tr><td align=left>
             <tr><td align=center colspan=2></td></tr></table>
        <p><center><input type="submit" value="Upload!" id="upload" name="file" /></center>
        </form>
        </body>
        </html>


    <?php
    } else {
    /* [url]http://localhost/upload.php:[/url]
    print_r($_POST);
    print_r($_FILES); */


    $ch curl_init();

    //$data = array('name' => 'Foo', 'file' => '@C:\Users\vigge_sWe\Desktop\template\template\style.css');

    curl_setopt($chCURLOPT_URL'http://datashelf.net/upload.php');
    curl_setopt($chCURLOPT_POST1);
    curl_setopt($chCURLOPT_POSTFIELDS$_FILES['upfile']);

    curl_exec($ch);
    }
    ?>
    upload.php reports "You didn't pick a file to upload"
    Last edited by galaxyAbstractor; 12-16-2008 at 02:57 PM.

  5. #5
    tttony's Avatar
    tttony is offline x10 Sophmore tttony is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    ~ 10°10'27.10''' N 67°59'59'.59''' O elev. 457m
    Posts
    147

    Re: cURL

    I dont see this on your code:

    PHP Code:

    // you have put the dir file in your case is the tmp dir
    // or try ie: http://domain.com/file.ext
    $data = array('name' => 'Foo''file' => '@/home/user/test.png');

    // pass the data
    curl_setopt($chCURLOPT_POSTFIELDS$data); 
    try and tell me...
    Last edited by tttony; 12-16-2008 at 03:19 PM.
    PHP & MySQL Web Developer
    Free Domain co.cc

  6. #6
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: cURL

    Quote Originally Posted by tttony View Post
    I dont see this on your code:

    PHP Code:

    // you have put the dir file in your case is the tmp dir
    $data = array('name' => 'Foo''file' => '@/home/user/test.png');

    // pass the data
    curl_setopt($chCURLOPT_POSTFIELDS$data); 
    try and tell me...
    Because that is irrelevant. I am not trying to upload a file on server1.

    Think rapidshare.

    I want to upload $_FILES['upfile'], not a local file
    Last edited by galaxyAbstractor; 12-16-2008 at 03:25 PM.

  7. #7
    tttony's Avatar
    tttony is offline x10 Sophmore tttony is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    ~ 10°10'27.10''' N 67°59'59'.59''' O elev. 457m
    Posts
    147

    Re: cURL

    the problem is that upload.php is recursive, you need other script.php to do something... or you can use a variable ie:

    curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php?save_file');
    do you know I mean??
    PHP & MySQL Web Developer
    Free Domain co.cc

  8. #8
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: cURL

    well, cURL seem to not be able to send data, because it never leaves my computer. I used php.net's example files, it did not work.

    I sen't $data to test.php that var dumped $data and got NULL
    Last edited by galaxyAbstractor; 12-16-2008 at 03:47 PM.

  9. #9
    tttony's Avatar
    tttony is offline x10 Sophmore tttony is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    ~ 10°10'27.10''' N 67°59'59'.59''' O elev. 457m
    Posts
    147

    Re: cURL

    yes Im also testing here but its so weird...
    PHP & MySQL Web Developer
    Free Domain co.cc

  10. #10
    brunoais is offline x10 Sophmore brunoais is an unknown quantity at this point
    Join Date
    May 2008
    Posts
    111

    Re: cURL

    try using this part of coding:
    you should change "url of file to be downloaded to the server" to the actual url
    PHP Code:
    curl_setopt($chCURLOPT_URL,"url of file to be downloaded to the server");
    curl_setopt($chCURLOPT_HEADER0);
    curl_setopt($chCURLOPT_RETURNTRANSFER1); 


    $resultcurl_exec($ch); 
    this will download the code from the site:
    you'll assign
    and assign it to
    $result
    see if this is what you want
    now you may use:
    PHP Code:
    $datei fopen("http://datashelf.net/upload.php""w");
    fwrite($datei$result);
    fclose($datei); 
    to create the file and write the whole data

    If you need more help just ask, if I was useful please increase my reputation
    Last edited by brunoais; 12-17-2008 at 05:07 PM.

Closed Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. cURL Login And Cookies and Regex
    By Tau_Zero in forum Programming Help
    Replies: 4
    Last Post: 12-12-2007, 12:29 AM
  2. Any substitute of cURL?
    By nonsensep in forum Scripts & 3rd Party Apps
    Replies: 7
    Last Post: 10-24-2007, 08:56 PM
  3. is PHP curl enabled on the Absolut server?
    By LRgraham14 in forum Free Hosting
    Replies: 3
    Last Post: 09-09-2007, 03:12 PM
  4. About cURL installed on the server
    By kachon in forum Free Hosting
    Replies: 1
    Last Post: 02-18-2006, 10:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers