basic cURL question

Posted on 2006-04-21
Last Modified: 2008-03-04
Here is my code:

$curl_handle = curl_init($url) or die('You need cURL installed to use this tool.');
curl_setopt($curl_handle, CURLOPT_HEADER, 0);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);

How do I get the response comming from that url? (And I don't want to set returntransfer to 0.)
Question by:huji
    LVL 11

    Accepted Solution

       $curl_handle = curl_init($url);
       $info = curl_getinfo($curl_handle);
       print_r ($info);
    LVL 14

    Author Comment

    It is returning something like this:

    Array ( [url] => [content_type] => text/html [http_code] => 200 [header_size] => 302 [request_size] => 101 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.125 [namelookup_time] => 0.016 [connect_time] => 0.438 [pretransfer_time] => 0.438 [size_upload] => 0 [size_download] => 3042 [speed_download] => 2704 [speed_upload] => 0 [download_content_length] => 0 [upload_content_length] => 0 [starttransfer_time] => 0.906 [redirect_time] => 0 )

    The page content (the HTML in this case) is not there.
    LVL 14

    Author Comment

    I've found my mistake. Everything except the content is there. I get the header the way I usually do:
    print curl_exec($curl_handle);
    Thanks for your help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now