Hi everyone , I'm trying to login to a site and it does not work , I don't see the problem ..

        $user = 'user';
        $pass = 'pass';
        $url = 'http://ecat.elit.ro/Default.aspx';

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
        curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");    
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        $res = curl_exec($ch); 
        echo $res;  

Thank's in advance!

Edited by MWEB

4 Years
Discussion Span
Last Post by MWEB

it does not work

What does not work? What is supposed to happen, but doesn't? Be more specific. Are you sure that login like this is not blocked?


Sorry !

So .. it should login and it does not but show me the page .
Yes , i'm pretty sure that type of login isn't blocked because i know somenone that have maked this with Curl


So , maybe i should be more specific:

I have this file with the code from first post .
I acces this file it loads the url but no login error , so it does'nt try to login , so probably the problem is at the CURL_POST or CURL_POSTFIELDS .


UPDATE - After many tries and a review of login postfields my code try to login but it fails , the site says that the username or password are incorrect , my question is , do you think is a special way to include the user & password in postfields? *Note: URL is http://www.ecat.elit.ro/Default.aspx

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.