Jump to content

Recommended Posts

hello dear community, good day,

 

I've been having an issue trying to parse text in a span cass with DOM. Here is my code example. try to extract some lines out of a webpage - with following technique: with the Extraction of values of attributes of elements with DOMDocument. Here is what i have gathered and learned:

 

$remote = "http://website.com/"; $doc = new DOMDocument(); @$doc->loadHTMLFile($remote); $xpath = new DOMXpath($doc); $node = $xpath->query('//span[@class="user"]'); echo $node;

 

and this returns the following

 

error -> "Catchable fatal error: Object of class DOMNodeList could not be converted to string". 

 

And now - with this i need help.

 

What I am trying to do is parse the user name between this tag;

 

<div class="widget plugin-meta"> <h3 class="screen-reader-text">Meta</h3>

 

see more below:Here the concrete example view-source: https://wordpress.org/plugins/participants-database/ and https://wordpress.org/plugins/participants-database/

 

goal  i need the following data:

 

Version: Last updated: Active installations: Tested up:

 

view-source: https://wordpress.org/plugins/participants-database/

 

Proceedings; i checked the source of the webpage. i tried to find out whether the texte is related to some kind of pattern.i have looked closely and found that all of them have

class=”widget plugin-meta”

. Well - This will make extracting them, a piece of cake. I tried with the code below helps to filter html elements based on values of attributes.

but unfortunatley this ends up in a bad result; i need a helping hand and need to know how to parse the above mentioned data


Again; the goal: i need the following data:

Quote


Version:

Last updated:

Active installations:

Tested up:

 

 

Any idea for the starting-point!?  I love to hear from you.

 

I ignored everything in your post after the first few lines because it looked like unnecessary background information irrelevant to the question.

$node is an object. You cannot simply echo it. Do something else.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.