Results 1 to 13 of 13

Thread: How to display client ip using php script on non scripting server

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    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

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to display client ip using php script on non scripting server

    Please don't cross-post

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to display client ip using php script on non scripting server

    Quote 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.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to display client ip using php script on non scripting server

    visualAd is correct.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to display client ip using php script on non scripting server

    Quote 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

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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

  8. #8
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: How to display client ip using php script on non scripting server

    Quote 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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    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

  10. #10
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    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?

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to display client ip using php script on non scripting server

    Quote 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 !

  12. #12
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    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.

  13. #13
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: How to display client ip using php script on non scripting server

    Quote 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
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width