Echo Hyperlink with IP address to go to external webpage

hey you guys, I have this code from many months ago:

        echo '<tr>';
        $index = 0;
        foreach ($row as $key => $col) {
            if ($index === 0) { echo "<td><a href='' target='_blank'>$col<a/></td>"; }
            else { echo "<td>$col</td>"; }
    		echo '</tr>';

what I would like to do is sort out my superglobals so I can extract the actual IP and let the user click the link and send them to a page like this:

I can surely get the data I want from the server var, but the issue is, I don’t think there is one to do what I want, is there? what I’ve noticed is that, depending on the requesting computer, the data can be in all sorts of formats. here is what I’m current capturing with:



what are “all sorts of formats”? it should be only IPv4 or IPv6

they can be in many forms. some of them are like these:

so what I’m trying to do is extract the IP address, in the appropriate format, from those which ARE possible. obviously the last one of those above examples would not be possible, as it’s just an email server’s name. I think this is an easy issue, and maybe I just need a string function and the server var’s return value? I may have just solved my own problem. But can you tell me if you know what I mean here? thanks.

still don’t get what you want. why don’t you just take $_SERVER[‘REMOTE_ADDR’]?

yeah I don’t think we’re on the same page, chorn. that’s OK. I’ve found a workaround. so thanks for getting back to me. I’ll consider this thread closed.

Sponsor our Newsletter | Privacy Policy | Terms of Service