Greetings all,
I'm doing a screen scrape via PHP and I need to find all links in the returned data, which are dynamic links, and replace them w/ my own.
I'm thinking a regular expression would be the best bet, though xPath is not out of the question.
The links I need to find look like this:
....
<TD><div class='wrap4'><A HREF='e[B]quipment.asp?action=category&category=30&key=27030[/B]'><IMG ALT='' height='56' width='60' border=0 SRC='image.jpg'></a></div></TD>
<TD><A HREF='e[B]quipment.asp?action=category&category=30&key=27030[/B]'>Some Product
</A></TD>
....
<TD><div class='wrap4'><A HREF='[B]equipment.asp?action=category&category=30&key=27005[/B]'><IMG ALT='' height='93' width='60' border=0 SRC='image2.jpg'></a></div></TD>
<TD><A HREF='[B]equipment.asp?action=category&category=30&key=27005[/B]'>9' Another Product
</A></TD>
...
So I need to find any and all hrefs and replace w/ my own code. I'm thinking I'll replace w/ link to a template that will begin a shopping cart process, then use xPath to pull the selected data from the link into the template and go from there.
However, my experience w/ reg. expressions is limited, and finding all the dynamic links is beyond me.
Any advice someone can give on how to create the regular expression needed to to this, or an alternate method would be much appreciated.
Thanks in advance!
Cheers