473,395 Members | 1,497 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,395 software developers and data experts.

Obtaining the URL

$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but none
of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or the
Host: header is not filled in.

So are there any other methods of determining the URL of the script itself?

Alex
Jul 17 '05 #1
4 1444

"Alex" <al*******@hotmail.com> wrote in message
news:35********************@news20.bellglobal.com. ..
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but none of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or the
Host: header is not filled in.

So are there any other methods of determining the URL of the script itself?
Alex


The answer is no, as the URL itself is not passed in the request.
Jul 17 '05 #2
Chung Leong wrote:
"Alex" <al*******@hotmail.com> wrote in message
news:35********************@news20.bellglobal.com. ..
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but


none
of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or the
Host: header is not filled in.

So are there any other methods of determining the URL of the script


itself?
Alex

The answer is no, as the URL itself is not passed in the request.


Chung: the answer is yes... hint: use phpinfo() to find it... then
search the docs to see how to code it...

Both the source and the target are specified.

Michael Austin.
Jul 17 '05 #3

"Michael Austin" <ma*****@firstdbasource.com> wrote in message
news:VT******************@newssvr24.news.prodigy.c om...
Chung Leong wrote:
"Alex" <al*******@hotmail.com> wrote in message
news:35********************@news20.bellglobal.com. ..
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but


none
of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or theHost: header is not filled in.

So are there any other methods of determining the URL of the script


itself?
Alex

The answer is no, as the URL itself is not passed in the request.


Chung: the answer is yes... hint: use phpinfo() to find it... then
search the docs to see how to code it...

Both the source and the target are specified.

Michael Austin.


Read the OP carefully, pal. He was referring to a HTTP 1.0 scenario, where
the host name is not included in the request. In that case when two DNS
names are mapped to the same IP address, there's no way for the server to
tell which of the two was actually typed in.

Name-based virtual hosting requires HTTP 1.1--that's a well known fact.
Jul 17 '05 #4
Chung Leong wrote:
"Michael Austin" <ma*****@firstdbasource.com> wrote in message
news:VT******************@newssvr24.news.prodigy.c om...
Chung Leong wrote:

"Alex" <al*******@hotmail.com> wrote in message
news:35********************@news20.bellglobal.c om...
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but

none
of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or
the
Host: header is not filled in.

So are there any other methods of determining the URL of the script

itself?
Alex

The answer is no, as the URL itself is not passed in the request.


Chung: the answer is yes... hint: use phpinfo() to find it... then
search the docs to see how to code it...

Both the source and the target are specified.

Michael Austin.

Read the OP carefully, pal. He was referring to a HTTP 1.0 scenario, where
the host name is not included in the request. In that case when two DNS
names are mapped to the same IP address, there's no way for the server to
tell which of the two was actually typed in.

Name-based virtual hosting requires HTTP 1.1--that's a well known fact.


My apologies Chung, but, I did not see anywhere in the OP where he
mentions he was using HTTP 1.0. It is possible that he is, it is just
not stated. HTTP_REFERER is in both RFC's for HTTP. I don't have a
HTTP/1.0 server to test to see what server name is in the URL using
vhosts... I have used this reliably for a long time now...

So, Alex, did any of this solve your problem?

if not, then you can always define a <input type=hidden...> to define
the full path, however, you will need to be aware that anyone looking at
the source will be able to see it...

Michael Austin.
Jul 17 '05 #5

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

Similar topics

5
by: Martin | last post by:
Dear Group Sorry for posting this here. I'm desperate for a solution to this problem and thought some of you might have come across it with .NET and SQL Server. Let's assume I've the following...
0
by: Lennart Hoglund | last post by:
Uploading an Image to a Server using the method described in the Knowledge Base article Q315832, works fine and smoothly. Obtaining the Image Size using; ImageSize.Text = New...
4
by: What-a-Tool | last post by:
Is there an ASP method for obtaining the size of the clients display area? Think I can think of a method(havn't tried it yet) combining JavaScripting and ASP, but I was wondering if there was a...
6
by: Shaun Heveron | last post by:
Hi, I'm working on a portable ANSI C++ application designed to compile and execute under Windows and LINUX/UNIX. Is there a portable way of obtaining the current working directory? Sorry, if...
7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
3
by: Kamalanathan T. | last post by:
Hi, We have developed an Web application in ASP.NET with C# and we r using SQL Server 2000. We get the Timeout expired error, when more than 300 concurrent users hit the site. I hagone thru...
0
by: VP | last post by:
Hi there, well i am stuck on a problem with regards to obtaining security permissions on folders. At the moment I have created a simple treeview example which shows all sub-directories in a tree...
11
by: seannakasone | last post by:
Is there a way to get the callstack level in c++? for example, take the following code: void call3() { //callstack level would be 3 } void call2() { //callstack level would be 2 call3();
7
by: =?Utf-8?B?Sm9obiBTdGFnZ3M=?= | last post by:
Hello, Please read this all before giving an answer :) I'm doing some troubleshooting on a web application that my company wrote. It's written in asp.net 1.1. The error that the Event viewer...
2
by: anumsajeel | last post by:
Hi, Error Message:- error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.