|
Posted by deko on 02/10/07 04:52
"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:op.tnh2l8sgqnv3q9@misant...
On Fri, 09 Feb 2007 22:02:18 +0100, BKDotCom <bkfake-google@yahoo.com>
wrote:
> On Feb 9, 2:15 pm, "deko" <d...@nospam.com> wrote:
>
>> Are there any PHP functions that will help here? How to handle sub domains?
>> International domains?
>>
>> Thanks in advance.
>
> well, you found parse_url
> you might want to use regular expressions as well
>
> $long_string = 'A HREF="http://something.else.example.com/blah/?
> joe=bob"';
> if ( preg_match('|([^\s"\']*://[^\s"\']*)|',$long_string,$matches) )
Afaik protocols can only be a-z+, you don't have to capture the entire
match, and the url should have at least one character, so a little
optimised it would be:
'|[a-z]+://[^\s"\']+|i'
> {
> $url = $matches[1]; // http://something.else.example.com/blah/?
> joe=bob
$url = $matches[0];
===========================================
I've been thinking about this... see http://www.liarsscourge.com
I need to decide:
1) what TLDs I will accept
2) what protocols I will accept
so...
1 = common TLDs, including international TLDs
2 = http only
next...
-- assemble array of common/international TLDs
-- construct regex to search for TLDs in this array
developing...
Navigation:
[Reply to this message]
|