Jump to content

Your Own Ip Address? Server


Joseroy
 Share

Recommended Posts

Folks who want to do TCP/IP aware scripts are interested in accessing the currently used dynamic ip address of a PC or router. To do so, most use 3rd party web sites to provide the information. If the server hosting your own web site supports PHP, you can have your own web site provide your Autoit script the same information, only better since (1) the data is clean and without html tags so no parcing is necessary and (2) your Autoit scripts are more stable since you have control of your own web site. Simply save this PHP code with a .php extension and upload it to your web site (Obviously, if the web server hosting your web site does not support PHP, this won't work so check it out first with your web hosting ISP.):

I also have this PHP script on line for trial (although I probably won't have it on line for public use too long...) at:

Get My Current IP Address

If you view the source code of the page in the web browser, there is nothing there but your IP address.

<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Pragma: no-cache");

// The headers above insure the data is not cached.
// The Old Expire date is to insure any previous downloads are outdated.
// Do not put any comments above the header codes as PHP wants headers to be
//   the first lines in a PHP script.
// These headers are mostly for web browsers and probably have little use in Autoit scripts.

//********
// The code below filters out unnecessary data which might be fed into
//   the PHP script (accidental or intentional) -- otherwise can be a security hole.

if (!empty($_POST))
{
Exit;
}
if (!empty($_GET))
{
Exit;
}
if (!empty($_COOKIE))
{
Exit;
}
// This last check is reduntant to the above 3, but here just in case... 
if (!empty($_REQUEST))
{
Exit;
}

// This is not part of $_REQUEST, so must be filtered separately.
if (!empty($_FILES))
{
Exit;
}

//******
// The echo below is what is returned; the global IP address -- clean of any 
//   html tags, so no parcing is necessary upon receipt.

echo $host = $_SERVER['REMOTE_ADDR'];
exit;

// If your web hosting ISP supports PHP, you can place this PHP script
// in your web site and access it to check out the current IP global (dynamic) 
// address your PC is using directly or via a router (i.e., the dynamic IP  
// address your router is using.)

// If routers are used, you can configure the local and remote routers to forward 
// particular port/s to the PC's local IP addresses. Once the relevant IP addresses 
// and ports are known (mutually advised via email?), the local and remote PC's  
// can be made to talk to each other via an Autoit script.
?>

This is obviously simple PHP, but it works.

I hope it helps...

Jose

Link to comment
Share on other sites

  • 1 month later...

Looks like you're getting into the wonderful world of php too huh? Or are you a master?

Nice script!

http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...