john_bboy7 Posted February 22, 2009 Share Posted February 22, 2009 Ok i am looking for a php Script Which logs into phpbb forum and then view any topic.. I just want to view the topic (No posting required ) What i did was .. i am able to login in with this piece of code: <?php function cURL($url,$header,$cookie,$p) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, $header); curl_setopt($ch, CURLOPT_NOBODY, $header); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_COOKIE, $cookie); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); if($p){ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $p); }; $result = curl_exec($ch); curl_close($ch); if($result){ return $result; }else{ return curl_error($ch); }; }; $u = "??????"; $p = "??????"; $chek4 = cURL("http://www.????????.com/login.php", 0, 0,"username=$u&password=$p&autologin=on&redirect=viewtopic.php&t=2163362&login=Log%20in"); $PT = "/Set-Cookie:(.*):; Path=\/; HttpOnly/i"; preg_match($PT, $cookie, $cookiu); $cookie = $cookiu[1] . ":"; $chek5 = cURL("http://www.???????.com/viewtopic.php?t=2163362",1,$cookie,null); echo $chek5; ?> But the problem is that i cant view the topic? because i think my cookies are not being stored or something.. Anyone here willing to help? i Can provide 1 month Premium Rapidshare Account worth 5 pounds. I dont know if this is allowed ??? Thanks in Advance.. Quote Link to comment Share on other sites More sharing options...
jackpf Posted February 22, 2009 Share Posted February 22, 2009 Cookies are often set to work with one domain/subdomain. You should see how cookies are being set. Quote Link to comment Share on other sites More sharing options...
john_bboy7 Posted February 22, 2009 Author Share Posted February 22, 2009 Cookies are often set to work with one domain/subdomain. You should see how cookies are being set. Thanks For Replying But Where do i see that? i mean i tried every way to store cookies but still no luck. Quote Link to comment Share on other sites More sharing options...
webref.eu Posted February 22, 2009 Share Posted February 22, 2009 How are you getting a value for $cookie in the first place? Maybe you are missing this? Rgds Quote Link to comment Share on other sites More sharing options...
jeger003 Posted February 22, 2009 Share Posted February 22, 2009 how about storing cookies on your server? then delete them once they pass a certain time. Quote Link to comment Share on other sites More sharing options...
john_bboy7 Posted February 22, 2009 Author Share Posted February 22, 2009 How are you getting a value for $cookie in the first place? Maybe you are missing this? Rgds Using regex? Please can you correct it? if there is something wrong? Thanks Quote Link to comment Share on other sites More sharing options...
john_bboy7 Posted February 22, 2009 Author Share Posted February 22, 2009 how about storing cookies on your server? then delete them once they pass a certain time. Yeah but how to do that? Is there any topic here so i can get help on that? Quote Link to comment Share on other sites More sharing options...
jackpf Posted February 22, 2009 Share Posted February 22, 2009 On firefox, (if you dont have it, go get it ) when you log into PHPBB, go into tools, options, privacy, then view cookies. Then have click ont he PHPBB cookie(s) and where it says domain: , see what it says That might help. Then you can set the cookies to the same domain. Quote Link to comment Share on other sites More sharing options...
john_bboy7 Posted February 22, 2009 Author Share Posted February 22, 2009 @ jackpf i think i got the right coookies but still dont know whats the problem in my script.. Anyone Else Can solve my script? Quote Link to comment Share on other sites More sharing options...
pkchandra999 Posted May 16, 2009 Share Posted May 16, 2009 below is the link for your most of the answers. http://www.phpfreaks.com/forums/index.php/topic,248695.0.html i hope you can modify accordingly Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.