|
-
Jul 27th, 2006, 03:58 AM
#1
Thread Starter
Frenzied Member
How to display client ip using php script on non scripting server
Hi all . could any one show me how i can create a php script that when it is called by java script it displays user ip in webpages that does not support any scripting. (the page that i need to display ip on does not support any scripting). In anotherword, i have on website that supports php and other websites that does not support php and i want to using some type of php scrpt that when it is called from other pages it displays the php on website.Thanks
-
Jul 27th, 2006, 03:33 PM
#2
Re: How to display client ip using php script on non scripting server
You can invoke a web services from the web page using Javascript, but you cannot do it without JAvascript. Whats more, the web service must be on the same server as the page invoking that service.
-
Jul 27th, 2006, 06:39 PM
#3
Re: How to display client ip using php script on non scripting server
Please don't cross-post
-
Jul 28th, 2006, 12:30 AM
#4
Thread Starter
Frenzied Member
Re: How to display client ip using php script on non scripting server
 Originally Posted by visualAd
You can invoke a web services from the web page using Javascript, but you cannot do it without JAvascript. Whats more, the web service must be on the same server as the page invoking that service.
visual it is very possible to run a php script on a remote server and execute it with javascript on html page . I have seen such script long time ago but do not know how to make one yet!! They retrive the all the environment varibles of cliet side such as ip,,, and display it on page.
-
Jul 28th, 2006, 12:31 AM
#5
Re: How to display client ip using php script on non scripting server
-
Jul 28th, 2006, 12:34 AM
#6
Thread Starter
Frenzied Member
Re: How to display client ip using php script on non scripting server
 Originally Posted by penagate
visualAd is correct.
so u mean it is not possible to do like this ?:
<script type="text/javascript" src="http://www.remotesite.com/getEnv.php"></script>
using php,perl,asp,jsp
-
Jul 28th, 2006, 12:49 AM
#7
Re: How to display client ip using php script on non scripting server
Hmm... You could. If that script outputted Javascript code containing the variables.
It's still an excruciatingly clumsy way of doing it. And it relies on Javascript, obviously.
What isn't possible is to execute an HTTP request to a 3rd party server through Javascript, which was what visualAd and I were referring to before. But invoking it through a script tag like that should work.
It's still a dirty hack
-
Jul 28th, 2006, 01:21 AM
#8
Re: How to display client ip using php script on non scripting server
 Originally Posted by tony007
so u mean it is not possible to do like this ?:
<script type="text/javascript" src="http://www.remotesite.com/getEnv.php"></script>
using php,perl,asp,jsp
Browsers will cache that on a per session basis at least, in RAM. So it will only get executed once and any other site which uses the script will use the same variables.
-
Jul 28th, 2006, 02:32 AM
#9
Thread Starter
Frenzied Member
Re: How to display client ip using php script on non scripting server
visual so u are saying using :
<script type="text/javascript" src="http://www.remotesite.com/getEnv.php"></script>
on any html page will not execute the php script corectly ? i have seen many site they use such way to execute script for tracking!! if u think that is not corect then what is the proper solution? A lot of visitior tracking companies host the script on their own server and just give u java script code to execute the script and provide you with tracking service !! so how they services work?The reason i want to know because i am dealing with lots of webpages that i want provide service to them and they do not support php or asp or any type of scripting.Thanks
-
Jul 28th, 2006, 02:56 AM
#10
<?="Moderator"?>
Re: How to display client ip using php script on non scripting server
You could use the DOM to dynamically create and load the JS file, you would need to append a random value to stop it being cached by the browser, but in theory it should work. However if you are only tracking a user then why do you need the IP address shown?
-
Jul 28th, 2006, 03:02 AM
#11
Thread Starter
Frenzied Member
Re: How to display client ip using php script on non scripting server
 Originally Posted by john tindell
You could use the DOM to dynamically create and load the JS file, you would need to append a random value to stop it being cached by the browser, but in theory it should work. However if you are only tracking a user then why do you need the IP address shown?
well the reason is because i want to test if i actually geting the ip or not . as i said i want to know how to execute remote script from with in non scripting pages!! why you think value catched by he browser is a poblem ? could u give me an example i do not understand that part !
-
Jul 28th, 2006, 03:22 AM
#12
<?="Moderator"?>
Re: How to display client ip using php script on non scripting server
Because if the script is cahced by the browser a new script will not be downloaded, and so your code probearly won't be executed. Though you can get around this by setting heads to say that the script will expire imidately and that its non-cachable.
-
Jul 28th, 2006, 03:40 AM
#13
Re: How to display client ip using php script on non scripting server
 Originally Posted by john tindell
Because if the script is cahced by the browser a new script will not be downloaded, and so your code probearly won't be executed. Though you can get around this by setting heads to say that the script will expire imidately and that its non-cachable.
The best option is to append a random query string to the URI. Internet Explorer for one ignores no cache headers for Javascript
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|