Jump to content

How to get url?


Neriokas

Recommended Posts

Try this I had the same problems yesterday and i found this function it works great.

 

function curPageURL()
{

	$pageURL = 'http';		//Begins building Url

	if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}	// checks to see if it is a secure page if so adds s

	$pageURL .= "://";		//adds next part of url

	if ($_SERVER["SERVER_PORT"] != "80") 
	{
		$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
	}else{
		$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
	}
		return $pageURL;
}	// End Function curPageURL()

 

Good luck

Link to comment
https://forums.phpfreaks.com/topic/79733-how-to-get-url/#findComment-403957
Share on other sites

  • 5 months later...

I guess a URL can be got in many ways. You can get it for free from any space in internet, yahoo, google, etc. but also you can buy it in many other hosting services (there are many prices starting 2 dollar a month or so).

 

It really depends what do you need the URL for.

 

What languague is your primary?

 

 

Okay i have a very simple question, I'm kind of a noob in php + my english is 2nd language but ill try to explain this.

 

how to get an url?

 

<?php

$url = url;

echo $url;

?>

 

how to get the url of the page that a person is on that moment at?

Link to comment
https://forums.phpfreaks.com/topic/79733-how-to-get-url/#findComment-537948
Share on other sites

I guess a URL can be got in many ways. You can get it for free from any space in internet, yahoo, google, etc. but also you can buy it in many other hosting services (there are many prices starting 2 dollar a month or so).

It really depends what do you need the URL for.

What languague is your primary?

 

LOL hes not talking about getting a free/paid host, neither a domain name. He wants to get the current url by using php. And a URL (technically correct would be URI) is the address of the page, like www.yahoo.com, www.mysite.com/index.php etc.

 

Link to comment
https://forums.phpfreaks.com/topic/79733-how-to-get-url/#findComment-537971
Share on other sites

You know that's not what he meant, he meant getting the url of the current page, not buying a URL, don't be sarcastic.  You must have known that, I mean, read your quote, he clearly said "how to get the url of the page that a person is on that moment", he must already have a webserver and a domain.

Link to comment
https://forums.phpfreaks.com/topic/79733-how-to-get-url/#findComment-537972
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.