Quantcast
Channel: Login via curl to webmail - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Login via curl to webmail

$
0
0

I wanna login to my university webmail page by curllib.

I program following code to do that:

$url = 'http://eetd.kntu.ac.ir/mda2.asp';$reffer = 'http://sabamail.kntu.ac.ir:3000/WorldClient.dll?View=Main';$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";$cookie_file_path = "/var/www/cookie.txt";$post_fields = 'dom=ee.kntu.ac.ir&usr=hoseini&password=*****';$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);curl_setopt($ch,CURLOPT_REFERER,$reffer);curl_setopt($ch, CURLOPT_USERAGENT, $agent);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);$result = curl_exec($ch);curl_close($ch);echo $result;

but it will redirect to 1 again with out showing your password is wrong!where is problem?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles



Latest Images