Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 07-23-2009, 09:43 PM   #1
campimp
Confirmed User
 
campimp's Avatar
 
Industry Role:
Join Date: Jan 2007
Location: Gamehendge
Posts: 1,340
php question

wanting to store sitename as a php variable.

if url was www somesitename .com

i want my page to pull "somesitename" and store as php variable, without the www or the .com

any thoughts?
campimp is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-23-2009, 10:12 PM   #2
FlexxAeon
Confirmed User
 
FlexxAeon's Avatar
 
Industry Role:
Join Date: May 2003
Posts: 3,765
where is it pulling 'somesitename' from? from the url it's located at?

Code:
<? $somesitename = $_SERVER['SERVER_NAME']; 
$somesitename = str_replace( 'www.', '', $somesitename);
$somesitename = str_replace( '.com', '', $somesitename);
print $somesitename;
?>
__________________
flexx [dot] aeon [at] gmail
FlexxAeon is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-23-2009, 11:33 PM   #3
cLin
Registered User
 
Industry Role:
Join Date: May 2009
Location: Orange County, CA
Posts: 94
Code:
$domain_strip = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $_SERVER['HTTP_HOST']);
$domain = substr($domain_strip, 0, strpos($domain_strip, "."));
Grabs the domain name from website url. If that's what you want.
__________________
Chris
The Ex Girlfriend Pics
cLin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-26-2009, 03:50 AM   #4
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
Quote:
Originally Posted by cLin View Post
Code:
$domain_strip = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $_SERVER['HTTP_HOST']);
$domain = substr($domain_strip, 0, strpos($domain_strip, "."));
Grabs the domain name from website url. If that's what you want.
Erk.
Try:
Code:
echo parse_url($u,PHP_URL_HOST);
Where $u has your URL string.
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-27-2009, 05:33 AM   #5
daniel_webcams
Confirmed User
 
daniel_webcams's Avatar
 
Industry Role:
Join Date: Nov 2008
Posts: 2,491
Quote:
Originally Posted by FlexxAeon View Post
where is it pulling 'somesitename' from? from the url it's located at?

Code:
<? $somesitename = $_SERVER['SERVER_NAME']; 
$somesitename = str_replace( 'www.', '', $somesitename);
$somesitename = str_replace( '.com', '', $somesitename);
print $somesitename;
?>
__________________
Daniel,

Skype: [email protected]
ICQ: 354-220-339
Email: daniel@adultforce[dot]com


daniel_webcams is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.