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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:56:16+00:00 2026-05-24T07:56:16+00:00

In a remote site, there is a HTML file (say http://www.example.com/abc.html ), which reads:

  • 0

In a remote site, there is a HTML file (say http://www.example.com/abc.html), which reads:

<input id="ID1" name="NAME1" value="VALUE1">

In my PHP code in my server, I need “VALUE1” from http://www.example.com/abc.html. How can I do it using PHP?

Since the remote html is written in XHTML 1.0, I guess I could use an XML parser?


ADDED

Using xml_parse_into_struct, I obtained an array that contains:

[15] => Array
    (
        [tag] => INPUT
        [type] => complete
        [level] => 4
        [attributes] => Array
            (
                [TYPE] => hidden
                [NAME] => NAME1
                [ID] => ID1
                [VALUE] => VALUE1
            )

    )

How can I obtain “VALUE1”? I guess now this is more a question for handling arrays in PHP. I always know the name “NAME1”, but I don’t know the value “VALUE1”. So I want to obtain “VALUE1” using “NAME1” which is the information I know.

  • 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-24T07:56:16+00:00Added an answer on May 24, 2026 at 7:56 am

    Why not just using a simple regex?

    $html = '<input id="ID1" name="NAME1" value="VALUE1">';
    
    if (preg_match('/name="NAME1".+value="(.*?)"/i', $html, $matches)) {
       echo $matches[1];  // should echo VALUE1;
    }
    

    The only constraint is that name must appear before value in the HTML element.

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

Sidebar

Related Questions

1) I have a Drupal site located at http://example.com and I have a directory
A remote site is supplying a data structure in a js file. I can
i have part of Asp.NET 1.1 project. I work with remote site, which works
I'm buiding an HTML/jQuery site where almost all the content comes from remote JSON
Ok, here's the problem: The remote site needs to pull complex html page content
I cannot see an index.html in my site root. http://localhost/index.html does not work. Also
I'm planning to set up log shipping to a remote site for disaster recovery
i want to check remote url's page contents. IF remote site's page content contains
do you have any good suggestions how to backup remote php site and mysql,
The site that I am working on is at a remote server. I want

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.