inherit
71337
0
Sept 16, 2021 16:47:32 GMT -8
Zath
aka Salma or Ardbeg :
2,607
February 2006
sexysalma
|
Post by Zath on Nov 4, 2010 13:43:26 GMT -8
Hi. Is it possible with javascript or DOM etc. to reference an external page ? We have some great codes here but they are always looking at their own local page, finding elements and then performing an action.
I'm looking to read a single item on a page and replicate it on another. A game I play has a server status image that has three states. I would like to read the image name (ie. online.png, offline.png, maintenance.png) then apply my own image on my own fansite. It it sits in a named div. I have permission to use the info.
Can anyone guide me ?
Cheers.
|
|
proseth
inherit
-4235395
0
Nov 29, 2024 15:49:24 GMT -8
proseth
0
January 1970
GUEST
|
Post by proseth on Nov 4, 2010 15:17:59 GMT -8
You would use PHP to do something like this (there are other options, but PHP is the simplest). You basically want to load a PHP JavaScript file and make use of PHP's file_get_contents() function to do this.
So on your Header/Footer you would have:
<script src="http://website.com/script.php" type="text/javascript"></script>
Then in the external file you would use PHP's file_get_contents() function to search for the image and you'd echo it into JavaScript code.
I could possibly do this for you if you want, just drop me a PM. I'm not too active on ProBoards anymore but this is pretty simple to do.
|
|
inherit
106478
0
Dec 31, 2010 20:50:17 GMT -8
xcessive
291
June 2007
xcess
|
Post by xcessive on Nov 6, 2010 19:16:32 GMT -8
Yes, use Javascript to communicate with a server that is hosting a php script that gets, then returns the data on the other page.
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Nov 8, 2010 5:13:56 GMT -8
You _could_ use PHP, but it would take up a lot of server resources to download that page every time the PHP file is accessed. You'd be better off working with the server admin to have them set up a custom JavaScript file, e.g. <script src="http://www.their-website.com/server-status.js" type="text/javascript"></script>
Which would simply contain: var status = "online"; // or offline, etc.
|
|
inherit
71337
0
Sept 16, 2021 16:47:32 GMT -8
Zath
aka Salma or Ardbeg :
2,607
February 2006
sexysalma
|
Post by Zath on Nov 8, 2010 9:30:21 GMT -8
You _could_ use PHP, but it would take up a lot of server resources to download that page every time the PHP file is accessed. You'd be better off working with the server admin to have them set up a custom JavaScript file, e.g. <script src=" www.their-website.com/server-status.js" type="text/javascript"></script> Which would simply contain: var status = "online"; // or offline, etc. That would be the ideal situation and the same as NCSoft have for their games. Not sure if the people that operate this game would go that far. Still, its worth asking the question.
|
|
proseth
inherit
-4240239
0
Nov 29, 2024 15:49:24 GMT -8
proseth
0
January 1970
GUEST
|
Post by proseth on Nov 8, 2010 17:42:12 GMT -8
You _could_ use PHP, but it would take up a lot of server resources to download that page every time the PHP file is accessed. You'd be better off working with the server admin to have them set up a custom JavaScript file, e.g. <script src=" www.their-website.com/server-status.js" type="text/javascript"></script> Which would simply contain: var status = "online"; // or offline, etc. Of course this is the best option but it might be difficult to get a large company to take time to do this for him. It's worth a try, I suppose.
|
|
inherit
71337
0
Sept 16, 2021 16:47:32 GMT -8
Zath
aka Salma or Ardbeg :
2,607
February 2006
sexysalma
|
Post by Zath on Nov 9, 2010 3:21:06 GMT -8
You _could_ use PHP, but it would take up a lot of server resources to download that page every time the PHP file is accessed. You'd be better off working with the server admin to have them set up a custom JavaScript file, e.g. <script src=" www.their-website.com/server-status.js" type="text/javascript"></script> Which would simply contain: var status = "online"; // or offline, etc. Of course this is the best option but it might be difficult to get a large company to take time to do this for him. It's worth a try, I suppose. You're probably right there !
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Nov 10, 2010 15:20:59 GMT -8
You _could_ use PHP, but it would take up a lot of server resources to download that page every time the PHP file is accessed. You'd be better off working with the server admin to have them set up a custom JavaScript file, e.g. <script src=" www.their-website.com/server-status.js" type="text/javascript"></script> Which would simply contain: var status = "online"; // or offline, etc. Of course this is the best option but it might be difficult to get a large company to take time to do this for him. It's worth a try, I suppose. Indeed. But if you told them that you'd whore their bandwidth to leech it offer their HTML pages, they might reconsider.
|
|