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

Information from referring page

Suppose I call an image creating script from an html doc like so:

<img src="http://www.example.com/imagescript.php">

How can I tell the URL of the document requesting the image?

I thought it would be $url = $_SERVER['HTTP_REFERER']; but this doesn't
seem to work
--
Regards,

Geoff Berrow
Jun 27 '08 #1
3 1356
..oO(Geoff Berrow)
>Suppose I call an image creating script from an html doc like so:

<img src="http://www.example.com/imagescript.php">

How can I tell the URL of the document requesting the image?

I thought it would be $url = $_SERVER['HTTP_REFERER']; but this doesn't
seem to work
You can't do it with the HTTP referrer, because it is highly unreliable
and should never be relied upon. It can be faked and often enough it's
not available at all.

Dependent on what you're trying to do, you could append a query string
to the image script containing an ID or the name of the current page:

<img src="http://www.example.com/imagescript.php?page=42">

Then your script knows where the request most likely came from.

Just an idea.

Micha
Jun 27 '08 #2
Message-ID: <3m********************************@4ax.comfrom Michael
Fesser contained the following:
>Dependent on what you're trying to do, you could append a query string
to the image script containing an ID or the name of the current page:

<img src="http://www.example.com/imagescript.php?page=42">

Then your script knows where the request most likely came from.
Yes, I've done it like that and it works, but it's not so tidy.

I'm trying to recreate something like this page rank checker
http://pr.blogflux.com/ more out of curiosity more than anything.

I already have
<img src="http://www.ckdog.co.uk./pagerank/pr2.php?url=your_url_here>
working.

--
Regards,

Geoff Berrow
Jun 27 '08 #3
Geoff Berrow wrote:
Message-ID: <3m********************************@4ax.comfrom Michael
Fesser contained the following:
>Dependent on what you're trying to do, you could append a query string
to the image script containing an ID or the name of the current page:

<img src="http://www.example.com/imagescript.php?page=42">

Then your script knows where the request most likely came from.

Yes, I've done it like that and it works, but it's not so tidy.

I'm trying to recreate something like this page rank checker
http://pr.blogflux.com/ more out of curiosity more than anything.

I already have
<img src="http://www.ckdog.co.uk./pagerank/pr2.php?url=your_url_here>
working.

Unfortunately, Micha beat me to it and he's correct. HTTP_REFER is not
reliable, and, in fact, some firewalls strip it on purpose for security
reasons.

The bottom line is, you can't tell who's requesting it. All you can
really tell for sure are the URI being requested and the IP your server
is supposed to send it to. Nothing else is really accurate.

As to what they're doing - it looks like they're tying into Google's
page rank APIs. I've never done it (not worth the effort, IMHO), but
you can check the Google site to see how to do it.

But if all you want is the page rank, the Google toolbar (for your
browser) does it much better.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 28 '08 #4

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

Similar topics

3
by: Jenkins | last post by:
I have a page with frames. The left frame is a list of urls. The main frame is loaded based on the url that was clicked in the left frame. Is there a way for the main frame to tell which url was...
3
by: Gus M. Creces | last post by:
Hi... I'm looking for some information, technical, white paper - whatever - on how SFTP works. I need to add SFTP capabilities into an app's present FTP capabilities. I'm not really looking for a...
3
by: George | last post by:
VS.NET 2002\Web\VB I am trying to get the referring URL for one of my pages using this: Request.UrlReferrer.ToString Page 1 has a link to Page 2. I click on the link in Page 1, and go to...
2
by: buran | last post by:
Dear ASP.NET Programmers, I want to store the referring page of an .aspx page so that I can redirect the user back to the referring page if needed. I am using the following code snippet but...
3
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so...
4
by: Drew | last post by:
This might beyond the scope of this group because it deals with SharePoint, but I'm not sure if I can't get it to work because of SharePoint or because JavaScript is weird (I don't have much...
5
by: Christina | last post by:
I can't seem to find any reference for grabbing the title of the referring page, which I want to use for creating a link. i.e. document.write ("Our thanks to <a href='"+document.referrer+"'>"...
5
by: Phil | last post by:
What methods do we have of collecting information about browsing history? We would like to see the last few links that a client followed, prior to entering our site. I thought $_SERVER object...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.