I am trying to get the current URL the image is posted on. For example, take this:

http://cookyx.com/test/1.png
(or http://cookyx.com/sig.php?id=1)

Its not getting the current URL on THIS page rather the URL the image is hosted on. How do I fix/do this?

Thanks.

mlseim

03-15-2010, 11:40 PM

If that site does not belong to you, they can display (and hide the location) of any image
they want using PHP, and you will never know where the image is really stored.
That's the point of using PHP to "hide" the actual location of a file.

If the site belongs to you, that's a different story.
You can program the PHP to "show" whatever information you want.

I do that all the time with PDF files. I can serve the file using PHP and hide it's real location:
Example: http://www.catpin.com/pf.php?file=8uj321

UrbanTwitch

03-16-2010, 02:35 AM

(Cookyx) site belongs to me.

mlseim

03-16-2010, 12:27 PM

So you want it so that if a visitor right-clicks on your graphic,
they get the URL of the graphic and not the PHP link?

I guess I don't understand the question.

UrbanTwitch

03-16-2010, 02:16 PM

For example, let's say I have the image put here.

Well, the referring url would be

http://www.codingforums.com/showthread.php?t=191582
Get it?

mlseim

03-16-2010, 04:19 PM

I feel like a dope for not understanding what the purpose is,
or why someone would need to know what the URL is for an image.
I apologize that I just can't figure out what you're looking for.

Maybe someone else can see it.

Fou-Lu

03-16-2010, 06:21 PM

Is the address in the HTTP_REFERER on the $_SERVER superglobal?

UrbanTwitch

03-16-2010, 10:19 PM

Is the address in the HTTP_REFERER on the $_SERVER superglobal?

How do I check that? phpinfo?

Fou-Lu

03-16-2010, 11:19 PM

How do I check that? phpinfo?

PHPInfo will show it yes. Otherwise, just check the $_SERVER['HTTP_REFERER'] or dump the entire $_SERVER superglobal to see whats in it.

Which appears to be correct (I presume that that threadid is correct). Note that HTTP_REFERER is not a guarenteed offset; its just commonly set. Potentially you have no referer, so try to attach from another referring page. Also, it may not be set if its you're home page for example. This you can certainly trap, if you cannot find an HTTP_REFERER offset, just give you're site instead.

Hah, too much java for you mate, you can't add a string in PHP ;)
That explains the mystery of the 0 :D