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_POSTFIELDS,
     'ctl00$ContentPlaceHolder1$LoginControl$tbLoginUser='.urlencode($user).'&ctl00$ContentPlaceHolder1$LoginControl$tbLoginPass='.urlencode($pass).'&ctl00$ContentPlaceHolder1$LoginControl$btnLogin=Intrare');
        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!

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

I can't test this without correct login data. On first glance your code looks fine.

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