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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:13:57+00:00 2026-05-23T12:13:57+00:00

I can access some of the ‘class’ items with a $ret = $html->find(‘articleINfo’); and

  • 0

I can access some of the ‘class’ items with a

$ret = $html->find('articleINfo'); and then print the first key of the returned array.

However, there are other tags I need like span=id”firstArticle_0″ and I cannot seem to find it.

$ret = $html->find('#span=id[ etc ]');

In some cases something is returned, but it’s not an array, or is an array with empty keys.

Unfortunately I cannot use var_dump to see the object, since var_dump produces 1000 pages of unreadable junk. The code looks like this.

<div id="articlething"> 
    <p class="byline">By Lord Byron and <a href="www.marriedtothesea.com">Alister Crowley</a></p> 
    <p> 
    <span class="location">GEORGIA MOUNTAINS, Canada</span> | 
    <span class="timestamp">Fri Apr 29, 2011 11:27am EDT</span> 
    </p> 
</div> 
<span id="midPart_0"></span><span class="mainParagraph"><p><span        class="midLocation">TUSCALOOSA, Alabama</span> - Who invented cheese? Everyone wants to know. They held a big meeting. Tom Cruise is a scientologist. </p> 

</span><span id="midPart_1"></span><p>The president and his family visited Chuck-e-cheese in the morning </p><span id="midPart_2"></span><p>In Russia, 900 people were lost in the balls.</p><span id="midPart_3">
  • 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-23T12:13:58+00:00Added an answer on May 23, 2026 at 12:13 pm

    Simple HTML DOM can be used easily to find a span with a specific class.

    If want all span’s with class=location then:

    // create HTML DOM
    $html = file_get_html($iUrl);
    
    // get text elements
    $aObj = $html->find('span[class=location]');
    

    Then do something like:

    foreach($aObj as $key=>$oValue)
    {
       echo $key.": ".$oValue->plaintext."<br />";
    }
    

    It worked for me using your example my output was:

    label=span, class=location: Found 1

    0: GEORGIA MOUNTAINS, Canada

    Hope that helps… and please Simple HTML DOM is great for what it does and easy to use once you get the hang of it. Keep trying and you will have a number of examples that you just use over and over again. I’ve scraped some pretty crazy pages and they get easier and easier.

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

Sidebar

Related Questions

I can use the MS Word ActiveX control in order to access some parameters
Can anyone give me some idea about uploading data from excel to access database
To access the array indice at the xth position we can use some sort
How can hibernate can access a private field/method of a java class , for
I want an admin role so that I can access some RESTful states while
i search a way how i can access a class in the sessionscope. I
I've been trying to access some instance methods of UITableView inside my UITableView class
I can access Spring beans in my Servlets using WebApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); in
I can access and show self.view and see the frame in the log but
We can access the valueStack (and other objects of ActionContext ) using OGNL but

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.