Forum Moderators: coopster

Message Too Old, No Replies

Reading HTML documents with PHP

         

jumpenjuhosaphat

10:59 pm on Aug 3, 2006 (gmt 0)

10+ Year Member



I need to have the ability to use PHP to read HTML document on other sites to find out if my link is in place on their site. I have searched the internet for this information, but the only thing that comes up is reading XML documents.

Any help would be appriciated. Thankyou.

bedlam

11:53 pm on Aug 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, it'll be a two or three step process I think:
  1. Retrieve the document
  2. Look for the desired content
  3. Do something based on the result of 1 and 2

For the first, you can use CURL [php.net], for the second, probably something like preg_match() [php.net], and finally, you may want to just output the result to the browser, or possibly send an email to yourself using mail() [php.net] if you plan to run the process automatically or semi-automatically.

Bear in mind that some webmasters may not appreciate this kind of activity--especially if you're checking many pages or very frequently--and may attempt to block the script's access to their site(s) by one means or another.

-b

jumpenjuhosaphat

1:04 am on Aug 4, 2006 (gmt 0)

10+ Year Member



I would just be using it to verify reciprocal links, and only once a week. I am trying to build a directory script, and was unclear on this, thanks for your suggestion, it should be very helpful.