answersLogoWhite

0

How do you get the URL in PHP?

User Avatar

Anonymous

13y ago
Updated: 8/16/2019

<?

// Answering "How do you get the URL in php?"

// Your Function for getting URL data

function curPageURL() {

$pageURL = 'http';

if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}

$pageURL .= "://";

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;

}

// Lets echo it out on your page ;)

echo curPageURL();

// Hope it works :)

?>

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How do you get the url in a php website?

Copy the URL with the .php, The .php is part of the page.


What is the GET method in PHP?

The GET method in PHP allows you to grab information from the URL to use in your script.For example, say you are on the URL index.php?id=1 you could then in the PHP script grab the id using the GET method to use in your script.


What does php mean at the end of an url?

Websites are servers that present pages as they are requested. Pages, in this context, are merely different kinds of files -- much like images and word documents. The "php" appended at the end of a URL indicates you are requesting a PHP type file, which is composed with the PHP language. PHP is a programming language that stands for "PHP: Hypertext Preprocessor." It is used to develop websites that present dynamic content and allow page-to-page interaction, such as forums and wikis.


How do you save image url in database by using php?

If you can get the image url then just assign it to a php variable say: $image = (See related Link) Then you just have to add '$image' to the insert statement of your sql query Note: It would be better to store the folder path where your image is stored. That way your image will not be lost if your site moves to another server.


How do you give href toanother php page?

Here is the code below to redirect a webpage using php: &lt;?php header('Location: url of the webpage'); // example: header('Location: index.php') exit; // exit after redirection is very important as php executes code line by line ?&gt;


Where can you find a video website for kids?

Here is a List: [url]http://askyourpc.com/blog1.php/fun/on-the-web/is-there-a-youtube-for-kids[/url] or go here: www.totlol.com


What are the answers to test2 on Howrse?

http://www.howrseinfo.com/level2.php this is the URL for a page with all of the answers for this quiz


Answers to howrsequiznumber 8?

http://www.howrseinfo.com/level8.php this is the URL to the page with all of the answers to this quiz


What is the maximum size of url address in browser?

100 characters (I think because that is the maximum for the php _GET Mothod)


How to change the wrong name printed in Indian passport?

Refer this URL: http://www.indiacgny.org/php/showContent.php?linkid=229


What are the answers to Howrse gallop number 8?

http://www.howrseinfo.com/level8.php this is the URL to the page that has all of the answers to this quiz


Answergs to Howrse ridin level 2?

http://howrseinfo.com/level2.php this is the URL to the page that has all of the answers to this quiz.