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

  • Home
  • SEARCH
  • 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 8428241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:59:54+00:00 2026-06-10T04:59:54+00:00

I’m using PHP Simple HTML DOM Parser And I have some HTML codes that

  • 0

I’m using PHP Simple HTML DOM Parser And I have some HTML codes that from it i want to extract the first number appear, in this example is ‘735438‘:

<!-- Some Tds without onclick atribute ->
<td onclick="StatsAnnonce ('735438');" style="CURSOR:pointer;"  onmouseover="return escape('<img  src=/images/icon_stats.gif border=0 width=13 height=14> <b>Statistiques de cette annonce</b><li>Affichages des détails annonce</li><li>Classement par mois et par pays.</li>');">&nbsp;&nbsp;<img  src="/images/icon_stats.gif" border="0" width="13" height="14" alt="Statistique annonce">&nbsp;Stats&nbsp;</td>
<td onclick="ModifAnnonce ('735438','1','302528');" style="CURSOR:pointer;"  onmouseover="return escape('<img  src=/images/button_edit.gif border=0 width=13 height=14> <b>Editer cette annonce</b><li>Modifier : titre, texte, prix</li><li>Ajouter/Supprimer des photos</li>');">&nbsp;&nbsp;<img  src="/images/button_edit.gif" border="0" width="13" height="14" alt="Modifier l'annonce">&nbsp;Modif&nbsp;</td>
<td onclick="ProlongerAnnonce ('735438');" style="CURSOR:pointer;"  onmouseover="return escape('<img  src=/images/button_calendar.gif border=0 width=14 height=14> <b>Renouveler cette annonce</b>');"><img  src="/images/button_calendar.gif" border="0" width="14" height="14" alt="Renouveler l'annonce">&nbsp;Renouv&nbsp;</td>
<td onclick="DeleteAnnonce('735438','06/08/2012 00:50','302528','Bon appart s+1');" style="CURSOR:pointer;"  onmouseover="return escape('<img  src=/images/button_trash.gif border=0 width=13 height=14> <b>Supprimer cette annonce</b>');"><img  src="/images/button_trash.gif" border="0" width="13" height="14" alt="Supprimer l'annonce">&nbsp;Suppr&nbsp;</td>

I have tried with this code(according to the doc instructions) but not working :

$html = str_get_html('page.html');

// Find all <td> with the 'onclick' as attribute
$ret = $html->find('td[onclick]');


// Find just all <td>
$ret = $html->find('td');


foreach($ret as $val)
{
echo $val."<br/>";
}

The result is just a blank page with no code…
I’m newer too HTML DOM Parser, please if somewone have worked with this library help me…

Thanks in advance

  • 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-10T04:59:56+00:00Added an answer on June 10, 2026 at 4:59 am

    First, I’d make sure that you’re actually reading in the document (I’m pretty sure you’re not at this point). You should be using:

    $html = file_get_html('page.html');  // This!
    //$html = str_get_html('page.html'); // Not this!
    

    Assuming you’re trying to extract information from the onclick attribute, it seems you should use this in your foreach loop:

    echo $val->onclick . "<br/>";  // This!
    //echo $val."<br/>";  //Not this!
    

    $val is still an html element at this point – I’m not sure what you’ll get if you echo it out, but I’m guessing it’s not what you’re looking for.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

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.