Jump to content

Curl Phpbb Login help?


john_bboy7

Recommended Posts

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.. :)

Link to comment
Share on other sites

On firefox, (if you dont have it, go get it :D) 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.

Link to comment
Share on other sites

  • 2 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.