/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] how to get domain name from a url

hi

can anyone help me in this

i have a list of urls stored in the database.

i need to print just the domain name from each url stored in the database using php code

thanxs
keats

to post a comment
PHP

10 Comments(s)

Copy linkTweet thisAlerts:
@bokehJul 14.2005 — [URL=http://www.webdeveloper.com/forum/showthread.php?t=72790]That has already been answered[/URL]
Copy linkTweet thisAlerts:
@atwJul 14.2005 — I think bokeh meant to point you at something like this:

http://www.webdeveloper.com/forum/showthread.php?s=&postid=211389#post211389
Copy linkTweet thisAlerts:
@bokehJul 14.2005 — I think bokeh meant to point you at something like this:

http://www.webdeveloper.com/forum/showthread.php?s=&postid=211389#post211389[/QUOTE]


Ive edited the link now. Sorry for the confussion!
Copy linkTweet thisAlerts:
@keerthiauthorJul 15.2005 — sorry for confusion.this is the correct url link what bokeh meant.

http://www.webdeveloper.com/forum/showthread.php?t=72790

thanxs to all

keats
Copy linkTweet thisAlerts:
@HuevoosJul 15.2005 — sorry for confusion.this is the correct url link what bokeh meant.

http://www.webdeveloper.com/forum/showthread.php?t=72790

thanxs to all

keats[/QUOTE]

File not found

Anyway, you could use the explode function

something like
[code=php]
$domain = explode(".", "http://www.google.com");
[/code]

would output something like
[code=php]
$domain[0] = "http://www";
$domain[1] = "google";
$domain[3] = ".com";
[/code]
Copy linkTweet thisAlerts:
@BeachSideJul 15.2005 — File not found

Anyway, you could use the explode function

something like
[code=php]
$domain = explode(".", "http://www.google.com");
[/code]

would output something like
[code=php]
$domain[0] = "http://www";
$domain[1] = "google";
$domain[3] = ".com";
[/code]
[/QUOTE]


Using [B]just that function[/B] get the domain from this url...
<i>
</i>http://www.google.com/search?lr=&amp;ie=UTF-8&amp;oe=UTF-8&amp;q=sorry%20for%20confusion.this%20is%20the%20correct%20url%20link%20what%20bokeh%20meant.
Copy linkTweet thisAlerts:
@bokehAug 26.2006 — I've replied on http://www.webdeveloper.com/forum/showthread.php?p=627866#post627866, maybe that helps[/QUOTE]Didn't you notice this thread is more than a year old?
Copy linkTweet thisAlerts:
@saul11Aug 26.2006 — That doesn't matter to me.
Copy linkTweet thisAlerts:
@bokehAug 26.2006 — That doesn't matter to me.[/QUOTE]Don't you think your time would be better used answering current problems?
×

Success!

Help @keerthi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...