473,461 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 25514
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: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.