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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:53:28+00:00 2026-06-13T18:53:28+00:00

Possible Duplicate: innerHTML in PHP’s DomDocument? I’m writing an application to fetch preview content

  • 0

Possible Duplicate:
innerHTML in PHP’s DomDocument?

I’m writing an application to fetch preview content from rss feeds.
For that I want to get the HTML content of a specific div.

The text I am fetching looks like this

<P>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean egestas enim non tellus interdum mollis. Pellentesque accumsan, purus quis facilisis vulputate,</P>
<P>leo enim rhoncus velit, non consectetur lacus libero a eros. Fusce rutrum, sapien eget facilisis placerat, metus enim sagittis ante, quis elementum velit tortor sit amet purus. </P>
<P>Mauris accumsan, dolor quis mollis iaculis, metus nisl lacinia neque, vel condimentum erat nisl ut lorem. Cras vestibulum urna in nisl ullamcorper rhoncus tincidunt massa </P>
<P>pretium. Nunc dui est, imperdiet et vulputate sit amet, facilisis semper ante. Duis ac ornare elit. Morbi gravida dolor vitae nunc tempus a hendrerit odio posuere. Morbi </p>

But when I have curld the page and parse it en get the nodeValue I get text without the Paragraph tags

$dom = new DOMDocument();
$dom->validateOnParse = false;
$html = get_data($item['link']);
$dom->loadHTML($html);
$storycontents = $dom->getElementById('story-body-text');
echo '<TR><TD>'.$storycontents ->nodeValue.' </TD></TR>';

Is there a way in DOMDocument to get the “innerHTML” property of a specific id?

  • 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-13T18:53:29+00:00Added an answer on June 13, 2026 at 6:53 pm

    Thanks to @simone How to get innerHTML of DOMNode?

    $tmp_dom = new DOMDocument(); 
    $tmp_dom->appendChild($tmp_dom->importNode($child, true)); 
    $innerHTML.=trim($tmp_dom->saveHTML()); 
    

    Didn’t show up in my search, but thank you none the less.

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

Sidebar

Related Questions

Possible Duplicate: Call php function from javascript I understand that php is server side
Possible Duplicate: how to pass variables from php page to javascript and display the
Possible Duplicate: Is it possible to append to innerHTML without destroying descendants' onclick functions?
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can’t create handler inside thread that has not called Looper.prepare() inside AsyncTask
Possible Duplicate: get current latitude and longitude from gps enabled device I use the
Possible Duplicate: php in javascript? I need to check an if condition inside the
Possible Duplicate: How to pass JS variable to php? pass a js variable to
Possible Duplicate: Remove duplicates from array Could you please help me out. I have

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.