Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3404004
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:19:46+00:00 2026-05-18T05:19:46+00:00

I am trying to extract some data from a private forum. I created a

  • 0

I am trying to extract some data from a private forum. I created a PHP Script that uses CURL to log in, and DOMDocument to extract page data.

I have successfully logged in with the script, but it acts as if I never logged in as soon as I try to load a web page using loadHTMLFile().

Someone told me that I may need to send cookie headers? But I have no idea how to do that or if it’s even necessary.

Anyone have any ideas?

    <?
function vBulletinLogin($user, $pass)
{
       $md5Pass = md5($pass);
       $data = "do=login&url=index.php&vb_login_md5password=$md5Pass&vb_login_username=$user&cookieuser=1";
       $ch = curl_init();

        curl_setopt ($ch, CURLOPT_URL, "****"); // replace ** with tt
        curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
        curl_setopt ($ch, CURLOPT_TIMEOUT, '10');
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
        curl_setopt($ch, CURLOPT_COOKIEJAR, "/public_html/phpcrawl/cookies.txt");
        curl_setopt($ch, CURLOPT_COOKIEFILE, "/public_html/phpcrawl/cookies.txt");
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_REFERRER, "****"); 
        $store = curl_exec ($ch);
        echo $store; <- **this shows that I have successully logged in, it gives me a welcome message**
        print_r($_COOKIE);

        curl_close($ch);

       $pos = strpos($store, "Thank you for logging in");
       if($pos === FALSE) RETURN 0;
       else RETURN 1;

}
if(vBulletinLogin("****","****")) echo "Logged In";
else echo "Failed to Login check User / Pass";

$url="http://texturl.com";
echo $url."<br>";

//get new HTML document
$html = new DOMDocument(); 

$html->loadHTMLFile($url);
print $html->saveHTML(); <- shows a login and password box saying I am not logged in. 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:19:47+00:00Added an answer on May 18, 2026 at 5:19 am

    I believe you have to use curl each time after to fetch your html pages, you use curl the first time to login, which saves the cookie for being logged in, into its cookie jar. So that the next time you use curl (with the same cookie jar) it will post the cookie data and the server knows you are logged in. Switching to use domdocument I don’t believe is going to use curl’s cookie jar to say you are logged in.

    You’ll need to use curl to fetch the html, then you can maybe pass the html to a domdocument and parse it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a xml that I'm parsing and trying to extract some data from.
I'm trying to extract data from a data file that's tab-delimited (in some parts),
I am building application that required some data from iPhone's Call log(read only). The
I'm trying to extract some data from various HTML pages using a python program.
I am trying to extract some data from XML but when I execute the
I am trying to extract some data from a website using a LINQ statement,
I am trying to extract some meta data from Oracle about foreign keys. I
I'm trying to write a code to extract some form data from a HTML
I'm trying to write a log parsing script to extract failed events. I can
I am trying to extract some parts of the Video: line from below text.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.