473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Url of the calling page

Hello,

I is probably a trivial question, but I didn't find the answer.

In a PHP 4 script, How to get the url of the page that called the script?

Thank you very much in advance if you know the answer.
Jul 17 '05 #1
3 25501
Mario Groleau wrote:
Hello,

I is probably a trivial question, but I didn't find the answer.

In a PHP 4 script, How to get the url of the page that called the script?


Are you meaning the referring page? If so, $_SERVER['HTTP_REFERER']

However, you cannot depend on this value being set, as the user may have
come straight to your page from typing it in, copying and pasting or using
a bookmark, or they may have a browser option or other software which
prevents this information from being passed to the server.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #2
On 14 Oct 2004 16:14:05 -0700, ma***********@mgroleau.ca (Mario Groleau)
wrote:
Hello,

I is probably a trivial question, but I didn't find the answer.

In a PHP 4 script, How to get the url of the page that called the script?

Thank you very much in advance if you know the answer.


$callingURL = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
The HTTP_HOST should contain the domain details up to (but not
including) the trailing slash. PHP_SELF should include the slash after
the domain and any path to the script thereafter:
www.foo.com/path/to/myscript.php
HTTP_HOST would contain 'www.foo.com' and PHP_SELF would contain
'/path/to/myscript.php'.

If your URL happens to use a query string too:
www.foo.com/path/to/myscript.php?foo=bar
then $_SERVER['QUERY_STRING'] should contain everything from the '?'
onwards.
HTH =)

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/
Jul 17 '05 #3
Mario Groleau wrote:
Hello,

I is probably a trivial question, but I didn't find the answer.

In a PHP 4 script, How to get the url of the page that called the script?

Thank you very much in advance if you know the answer.


$_SERVER["HTTP_REFERER"]
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: qaz | last post by:
I have login links on a number of pages in my site. Some of the pages expect variables on the querystring. I want to be able to login from any of these pages. The login link redirects me to a...
4
by: Chad Richardson | last post by:
As I'm writing this I think I am answering my own question, but I'd like to get any other ideas on the subject as well. I have a standard Header.asp that I want to include in every other page in...
5
by: mg | last post by:
Is there a simple way to determine the name & path of the Web page that calls a WebForm when the calling page is another type such as an html, jsp, or .do file.
3
by: MattB | last post by:
I have a UserControl that I use as a page header for my app. I want it to vary depending on what page it's being called by. In the CodeBehind, how to I refer to the calling page? Thanks! -- ...
1
by: JezB | last post by:
Within some library class, is there a way I can I determine which webpage called it, without having to pass in the calling Page object ? I only need the page name rather than the Page object. ...
2
by: Harold | last post by:
I have page A with form field and a button and when button is clicked it opens page B in another window. Page B has a treeview control and that is all. When something is selected I want the page...
1
by: desmcc | last post by:
Hi, I am launching a modal dialog through the usual javascript (window.showmodaldialog). When the modal dialog is complete (ie user selects OK), the calling page then refreshes itself by setting...
0
by: jobs | last post by:
I have a page where users select from a bunch of gridviews, setting session variables and then hit an a New or Edit button which redirects them to a formview in edit or insert mode. While in...
2
by: eholz1 | last post by:
Hello PHP Group, I have a php page that calls another php page to load a image from a database (mysql) in to the calling page. It works like this: first_view.php has <img src="image.php?img=5"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.