i want to play with curl functions for different examples!
for example i want to login to chatrooms by this code:
<?php
$url = 'http://www.lxchat.ir/';
$postVars = array('username'=>'Alberto','password'=>'','gender'=>'1');
$tmpfname = dirname(__FILE__).'/cookie.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_TIMEOUT, 60);
curl_setopt($ch,CURLOPT_POST,TRUE);
curl_setopt($ch,CURLOPT_POSTFIELDS,$postVars);
curl_setopt($ch, CURLOPT_COOKIEJAR, $tmpfname);
curl_setopt($ch, CURLOPT_COOKIEFILE, $tmpfname);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$run = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
echo $info['redirect_url'];
?>
but this code didn't work!!! how to resolve this problem?
1- Login to chatroom
2- send a message
please help me ...
Thanks