PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
A few months back I brought up the topic of making a custom 'home page'. Complete with checking new messages on your mail server and new messages/posts on this lovely forums.
I got back into doing it. I just installed cURL on my localhost. I hope it went right anyhow. Here's what I got:
$url = "http://forums.devnetwork.net/login.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=nay&password=123456&login=Login");
$result = curl_exec($ch);
curl_close($ch);
if(preg_match("|View posts since last visit \(([0-9]+)|",$result,$matches)){
echo "Found ".$matches[1]." new posts";
}
if you need the new post count.....
Last edited by Weirdan on Thu Jan 08, 2004 1:11 am, edited 1 time in total.