Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Using variables on another site
06-17-2010, 07:57 AM #1
- Join Date
- Oct 2007
- Thanked 79 Times in 79 Posts
Using variables on another site
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.PHP Code:
$aString = is_string((string)array()) ? true : false; // true :D
06-17-2010, 08:54 AM #2
- Join Date
- Jan 2010
- Thanked 3 Times in 3 Posts
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.