|
Posted by BKDotCom on 02/09/07 21:02
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) )
{
$url = $matches[1]; // http://something.else.example.com/blah/?
joe=bob
$parts = parse_url($url);
if ( preg_match('/(.+)\.\w+\.\w+/',$parts['host'],$matches) )
echo $matches[1]; // something.else
}
[Back to original message]
|