Jump to content

Taking information from a site


Arkane

Recommended Posts

HEy,

 

I'm trying to write a script to get data off of another site (with admins approval) but I'm having a bit of a problem to take the actual data.

 

I'm trying to use preg_match to find the data I need, but just cant get the thing to work for anything more complicated that telling me if there is a t in test.

 

   <td class="reltdd">Serial Code</td>
   <td class="reltdv">5445-9826</td>

This is the html that i am trying to scrape.  theres more, but its all the same pretty much.  What I'm looking to get is the '5445-9826' but since the td is a class that is referred to multiple times, the only thing unique to the date is the 'Serial Code' text.

 

I've gotten the site info via file_get_contents() and its all in the one variable - $raw .

 

I've tried

preg_match("/<td class="reltdd">(.*)</td>/", $html, $matches);
echo $matches;

but it had no return whatsoever.  i have also echoed $html so I know it got the data correctly.

 

I know that what I have there should only return 'Serial Code' but sinceI can't even get that to work I have no chance with the rest.

 

Any help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/173990-taking-information-from-a-site/
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.