+ Reply to Thread
Results 1 to 2 of 2

Thread: using cURL to get data

  1. #1
    ryanmaelhorn77 Guest

    using cURL to get data

    I'm still trying to get this simple script to work. I swtiched over to using the cURL library on the reccomendations of others. It still isn't working though. I get no error msg when I load the page, but no data either. x10 has cURL installed, right?

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    
    <body>
    
    <h2>Data=</h2>
    
    <?php
    // Init $GetData as a cURL object
    $GetData = curl_init();
    // Tell cURL what URL we want to FTP
    $fp = fopen(__FILE__, "r"); 
    $url = "ftp://MyFTPusername:MyFTPpassword@Thumbscalp.com/Signal/test.txt"; 
    curl_setopt($GetData, CURLOPT_URL, $url);  
    // Tell cURL we would like the results as a string instead of just dumping it on the screen
    curl_setopt($GetData, CURLOPT_RETURNTRANSFER, 1);
    // Execute the cURL request
    $data = curl_exec($GetData);
    // Close the cURL request
    curl_close($GetData);
    // Display the data from the variable to ensure its there.
    var_dump($data);
    ?>
    
    </body>
    </html>
     
     

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: using cURL to get data

    Do the script and test.txt exist on different hosts? If not, there's no need for cURL.

    Do you have a live test page we can see?

    You need to add some error handling. Test whether the result of curl_exec is False. You can use curl_error to get an error messag, but be careful that it doesn't reveal too much information.

    Quote Originally Posted by ryanmaelhorn77 View Post
    x10 has cURL installed, right?
    Calling an undefined function will result in a fatal error. Unless you've turned off all error reporting, you can be assured the cURL extension is loaded. You can always use extension_loaded to test whether or not an extension is loaded.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Curl
    By cooljaipur in forum Free Hosting
    Replies: 1
    Last Post: 02-06-2010, 09:46 AM
  2. Help me cURL
    By tientrien in forum Free Hosting
    Replies: 3
    Last Post: 03-27-2009, 01:14 PM
  3. Curl PHP
    By Azagthot in forum Free Hosting
    Replies: 3
    Last Post: 09-03-2008, 10:45 AM
  4. curl
    By chongkolai in forum Free Hosting
    Replies: 1
    Last Post: 10-19-2007, 02:02 PM
  5. Curl
    By skulldragon3200 in forum Free Hosting
    Replies: 3
    Last Post: 08-19-2007, 11:46 AM

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