...

View Full Version : Using variables on another site



Zangeel
06-17-2010, 07:57 AM
Hello,

I'm wondering if something's possible, let's say I create an image script "www.site.com/image.php" (this page would have an image/badge rendered by php) which I embed into another site that I do not run, is it possible to then use the information on that site to make the image dynamic. For example if the site I embed it on is "www.site2.com/profile.php?user=username" could I take the variable $_GET['user'] and use it to make the image say the username?

Any examples would help, I'm basically trying to make some badges that people can put on their profile without having to alter the image html, for example I don't want them to have to manually put their usernames on the html like <img src="httt://www.site.com/image.php?user=username" /> if you get what I mean.

Zoic
06-17-2010, 08:54 AM
If your PHP image is on another site, you don't have access to the $_GET variables on that site. Only if they are passed to your PHP image. So on site2, it would have to be image.php?user=username to get the username.

You "can" try to get the URL of the site that your image is displayed on by using $_SERVER["HTTP_REFERER"] but it isn't going to be very accurate all the time as it is possible for visitors to have that feature disabled/empty.

I would just stick with having them put in their username.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum