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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:18:19+00:00 2026-06-12T17:18:19+00:00

im brand new to php (started yesterday) ive got a decent background of html/css

  • 0

im brand new to php (started yesterday) ive got a decent background of html/css and a bit of js so i though id give it a shot.

Im trying to build a simple application to teach myself php and i wanted to reference a piece of html from another site, for example the div :

<div id="name"> <p>Sam</p> </div> on the page “http://www.example.com/about.php&#8221;

what i was trying was <?php echo file_get_contents("http://www.example.com #name"); ?> is that the right way to go about it ?

i was also couldnt work out if it was better to use include echo or echo file_get_contents

sorry for such a basic question

  • 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-12T17:18:20+00:00Added an answer on June 12, 2026 at 5:18 pm

    That can be done with DOMDocument, here’s an example:

    $doc = new DOMDocument();
    $doc->loadHTMLFile('http://example.com/');
    
    // get the element that has id=name
    $result = $doc->getElementById('name');
    
    echo $result->nodeValue; // prints: Sam
    
    // or print out $result to see all of the properties
    print_r($result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to parse and process HTML with PHP? I am brand new
I am brand-spanking-new to the namespace concept in php. The situation: Multiple files in
I'm brand new to php and I'm trying to work with some includes in
I'm brand new to php so struggling to figure this one out from existing
I have a brand new e-commerce website ( http://missfrisette.com/showphotos.php ) each item (hair clip)
Brand new to all of this and trying to install my PHP script. When
I am brand new to PHP and I have thousands of records I need
Brand new to the Log4Net library and there is something I have not been
Brand new to Python (and programming in general), if this is simple and/or answered
Brand new to Cocoa and I'm trying to figure out how to copy an

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.