0

I have a PHP script that generates dynamic images using GD. The image may be accessed remotely via, for example, http://mysite.com/scripts/phpimages.php

Any remote website such as example.com could able to render this image in its client side HTML img tag. For example:

<!-- http://example.com/about.html -->
<img src="http://mysite.com/scripts/phpimages.php" />

What I need that my script able to know the URL of the image requested page i.e http://example.com/about.html

0

1 Answer 1

3

Use this

 echo $_SERVER['HTTP_REFERER'];

To prevent errors,

if(isset($_SERVER['HTTP_REFERER'])) {
    echo $_SERVER['HTTP_REFERER'];
}
Sign up to request clarification or add additional context in comments.

3 Comments

Instead of echoing it, the value should be stored.
well, I just gave him a way to do that. Not sure how he is going to use it :)
@LawrenceCherone Yes it is that I really want to do. Store it in a database to know others websites render my image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.