Welcome to WebmasterWorld Guest from 50.19.34.234

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Top level Domain From a link?

     

havoc

12:54 am on Jul 30, 2003 (gmt 0)

10+ Year Member



Just a quick question i did some googling and it hasnt come up with anything yet. Obviously im looking for the wrong thing

Basically i want to get a top level domain out of a refer link so i can write me refers list. for example if the refer came from [widgetz.com...]
How do i use php to extract the [widgetz.com...] and kill the rest?

Thanks

smokin

1:18 am on Jul 30, 2003 (gmt 0)

10+ Year Member



I would use regular expressions to extract the tld from a url. Here is a site that has many free regexes. It probably has the one you want:
[regexlib.com ]

Timotheos

5:05 am on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think parse_url() [us2.php.net] is what you're after.

havoc

5:52 am on Jul 30, 2003 (gmt 0)

10+ Year Member



thanks

i used this example (

Example:
$url=parse_url(http://www.widget.net/download-php.php3?csel=br);

$url[scheme] = http
$url[host] = www.widget.net
$url[path] = /download-php.php3
$url[query] = csel=br

works good

vincevincevince

12:54 pm on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member



<?php
echo preg_replace("/^(http:\/\/[^\/]*).*/i","$1",$fullurl);
?>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month