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

  • Home
  • SEARCH
  • 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 7575801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:46:06+00:00 2026-05-30T16:46:06+00:00

I have the Simple HTML DOM Parser for PHP, and I am using the

  • 0

I have the Simple HTML DOM Parser for PHP, and I am using the following markup:

$html = file_get_html('http://www.google.com');

However how do I send post variables (like a cURL) to that page and get the response? For example

$html = file_get_html('http://www.google.com', array("Item"=>"Value", "Item2"=>"Value2"));
  • 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-30T16:46:07+00:00Added an answer on May 30, 2026 at 4:46 pm

    The documentation doesn’t mention it as far as I can see, but after taking a look in the source code I noticed the function you’re using accepts a stream context as its third argument. You can create a post request with this PHP feature like this:

    $request = array(
    'http' => array(
        'method' => 'POST',
        'content' => http_build_query(array(
            'Item' => 'Value',
            'Item2' => 'Value2'
        )),
    )
    );
    
    $context = stream_context_create($request);
    
    $html = file_get_html('http://www.google.com', false, $context);
    

    If you don’t like contexts or would prefer a different method (like the cURL extension) you could also just fetch the page content using that, then feed it to the parser with str_get_html() or $parser->load(); the class itself does pretty much the same internally with the method you’re using right now.

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

Sidebar

Related Questions

I have a working statement in PHP using the simple dom parser that I
I'm using the PHP simple DOM parser for filling an HTML template; it seems
I want to use simple_html_dom.php to do some work. $html = file_get_html('http://www.domain.com'); foreach($html->find('p') as
I am using the PHP lib Simple HTML Dom Parser, as suggested here (
i have this html code. Im using Simple HTML Dom to parse the data
PHP:: How can be taken charset value of webpage with simple html dom parser
New to the simple-html-dom-parser and have a question. Assuming $element is an array, how
I want to use the PHP Simple HTML DOM Parser to display all my
I want to use the php simple HTML DOM parser to grab the image,
Consider the following code: public ActionResult Index(String URLQuery = http://www.google.com) { HttpWebRequest webRequest; HttpWebResponse

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.