[PHP] Rewrite img and a tags.

2003-07-25 Thread Simon Fredriksson
How can I easiest rewrite A and IMG tags? I'm fetching a page with 
fsockopen() and I need to rewrite these tags before sending it on to a user.

My own theory is that it's made with Regular Expressions. I just don't 
know these myself.

Thanks.

//Laban

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Rewrite img and a tags.

2003-07-25 Thread CPT John W. Holmes
 How can I easiest rewrite A and IMG tags? I'm fetching a page with
 fsockopen() and I need to rewrite these tags before sending it on to a
user.

 My own theory is that it's made with Regular Expressions. I just don't
 know these myself.

If you're writing one of those anonymous browsing programs where
everything is requested through PHP and shown on your site with the links
rewritten, there's already one written on phpclasses.org. See how they do
it.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Rewrite img and a tags.

2003-07-25 Thread Curt Zirzow
* Thus wrote Simon Fredriksson ([EMAIL PROTECTED]):
 
 How can I easiest rewrite A and IMG tags? I'm fetching a page with 
 fsockopen() and I need to rewrite these tags before sending it on to a user.
 
 My own theory is that it's made with Regular Expressions. I just don't 
 know these myself.
 
The documentation for preg_match_all has an excelent pattern for
matching html tags:

preg_match_all (/(([\w]+)[^]*)(.*)(\/\\2)/, $html, $matches);

HTH,

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php