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

curl-and-php

RE: how to get the last fetched URL

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

Does the returned result page correspond to the redirected URL?

________________________________

From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Natasha Trovaldo
Sent: Wednesday, September 05, 2007 5:45 AM
To: curl-and-php_at_cool.haxx.se
Subject: Re: how to get the last fetched URL

Hi
 
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
 
domain.com?siteid=integerid
 
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
 
domain.com?siteid=integerid
 
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
domain.com?siteid=integerid
 
can anyone help please?
 
Natasha,
Free PHP Scripts Directory
www.scriptsbible.com
 
On 9/5/07, Natasha Trovaldo <scriptsbible_at_gmail.com> wrote:

        Hi
         
        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

        Natasha,
        Free PHP Scripts Directory And Resource Repository
        www.scriptsbible.com <http://www.scriptsbible.com/>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-09-05