Skip to content

Instantly share code, notes, and snippets.

@11mb
Created June 8, 2015 12:44
Show Gist options
  • Save 11mb/b2d744e917ede1c8eef4 to your computer and use it in GitHub Desktop.
Save 11mb/b2d744e917ede1c8eef4 to your computer and use it in GitHub Desktop.
Get outgoing ip adres of server
<?php
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
echo get_data('http://whatismyipaddress.com/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment