Hi Frendz,

I need to login with a site to get the content. I'm using the below code to do the same.

    <?php
        include_once('simple_html_dom.php');
        extract($_POST);

        if($submit)
        {
            $username = '*************';
            $password = '*************';
            $loginUrl = 'https://secure-admin.booking.com/booking.html?bn=685763648&hotel_id=439210&code=57ed501f25de55965e13ab29fcd936a3';

            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $loginUrl);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, 'loginname='.$username.'&password='.$password);
            curl_setopt($ch, CURLOPT_COOKIEJAR, 'C:\xampp\htdocs\nissi_booking\cookie.txt');
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
            curl_setopt($ch, CURLOPT_SSLVERSION, 3);
            $store = curl_exec($ch);

            $httpcode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
            var_dump($httpcode);



            echo curl_error($ch);

            echo $url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);

            /*$html = new simple_html_dom();
            //$contents = file_get_contents($txtURL);
            $html->load_file($txtURL);
            $ret = $html->find('div[class=span6]');
            echo $ret[0];
            echo $ret[1];*/
        }
    ?>

I have received $httpcode as int(200) but i have received the same url that i sent in curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); Kindly help me to get the CURLINFO_EFFECTIVE_URL or the session_id

So CURLINFO_HTTP_CODE and CURLINFO_EFFECTIVE_URL are returning the exact same thing?

Yup. CURLINFO_HTTP_CODE returns int(200) and CURLINFO_EFFECTIVE_URL

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.