cURL / Mailing Lists / curl-and-php / Single Mail


RE: how to get the last fetched URL

From: Broekhuis,Robert R. <>
Date: Wed, 5 Sep 2007 08:23:09 -0400

Does the returned result page correspond to the redirected URL?


[] On Behalf Of Natasha Trovaldo
Sent: Wednesday, September 05, 2007 5:45 AM
Subject: Re: how to get the last fetched URL

I am trying this code finally
$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
 curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_REFERER, $reffer);
 curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
    $urll = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);
 $result = curl_exec ($ch);
 echo $result;
 curl_close ($ch);
 echo "URL: $urll";

now there is one problem, the url it shows as the last fetched url is in
fact the local site url which i call from cURL which is like
this url is not my target because this redirects to the real site i want
that url to which it redirects e.g when you browse a url like
it will redirect to another site.. i am using this url in my cURL
session and trying to find the recent URL but my code is returning this
can anyone help please?
Free PHP Scripts Directory
On 9/5/07, Natasha Trovaldo <> wrote:

        I am trying to get only the last fetched URL by cURL session. I
tried to use curl_easy_getinfo() like this,
        $url = NULL;
        curl_easy_getinfo($ch, CURLINFO_EFFECTIVE_URL, $url);
        echo $url;
        but I get this error
        Fatal Error: Call to undefined function: curl_easy_getinfo()
        I have php 4.4.4 and cURL version 7.15.3
        I also tried Daniel this code,
         char *url = NULL;
         curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
        but then i get error that '=' sign required at line # 1
        Can anybody guide me please how to get the last fetched URL from
a cURL session?
        thank you

        Free PHP Scripts Directory And Resource Repository <>

Received on 2007-09-05