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 8477301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:25:39+00:00 2026-06-10T18:25:39+00:00

I am new at php, so bear with me. I want to parse some

  • 0

I am new at php, so bear with me.

I want to parse some html-data from a website, and i can do it with http://simplehtmldom.sourceforge.net/ pretty easy. The problem is that i need to get the data from a website, where i need to post some data, which means i can’t just use the url which the library needs. I can use the action and post i a form to redirect to the website, but i can’t get the information. Can you help me here?

Regards
Jesper

  • 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-06-10T18:25:42+00:00Added an answer on June 10, 2026 at 6:25 pm

    This code queries stackoverflow for your question using CURL:

    $url = 'https://stackoverflow.com/search';
    
    $params = preparePostFields( array(
         'q' => 'Getting data from a website where posted data is required',
       ));
    
    $ch = curl_init($url);
    
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    
    curl_close($ch);
    
    echo $result;
    
    exit;
    
    function preparePostFields($array) {
      $params = array();
    
      foreach ($array as $key => $value) {
        $params[] = $key . '=' . urlencode($value);
      }
    
      return implode('&', $params);
    }
    

    Regarding the CURLOPT_POSTFIELDS, please review this manual page:

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

Sidebar

Related Questions

New to PHP and MySQL, have heard amazing things about this website from Leo
I'm fairly new to MySQL and PHP, so bear with me. After some research,
I'm new to Joomla and PHP dev so bear with me. Pulling some simple
I am fairly new to PHP so please bear with me :) What I
im new in PHP and I want to know about PHP Zend Framework. What
Im new to PHP and I can't figure out what the rules are for
I'm quite new in PHP dev and I can't find a way to solve
I'm very, very new to PHP, so please bear with me. I'd like to
I am new to javascript and php and programming so pls bear with me.
I've built a new PHP site for a customer and want to redirect the

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.