Jump to content

parsing html document


alohatofu

Recommended Posts

I have a sample page located at http://projectkamalii.org/sampledata.htm

 

 

could someone please guide me on how to extract that data out? I'm thinking of using snoopy to assign each field a variable but don't know where to start.

 

could someone give me some guidance please?

 

I'm thinking of fetching the page with php and then output each field a variable say

 

the first field is Notice_ID would output 0068996

Link to comment
https://forums.phpfreaks.com/topic/47962-parsing-html-document/
Share on other sites

Ok, I've got it to where it will display all the text only.

<?php

      include("include/classes/Snoopy.class.php");
      $snoopy = new Snoopy;
      if($snoopy->fetchtext("http://xxx.xxx.xxxx.xxx/events/noticedetails.php?noticeID=0069040")){

      // print the texts of the website:
      print "<pre>".htmlspecialchars($snoopy->results)."</pre>\n";
      }
      else {
      print "Snoopy: error while fetching document: ".$snoopy->error."\n";
      } 
     
?>

 

the output of that code is something like this

 

this is the first line

this is the 2nd line of the paragraph

a thirdline is here

 

 

My question is can someone please guide me on how to not display the text but assign variables to to the text above? say I want  $var1 = first line

 

thanks

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/47962-parsing-html-document/#findComment-234552
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.