Hello, I noticed some time ago a website that allows you to find ip of a site you want,, I searched a lot but I can'' not found code that allows you finding a ip just by typing the URL in the box. I really appreciate who can help's me.

[img] http://i40.servimg.com/u/f40/17/20/93/30/untitl10.png [/img

.
.
.
.
.
.
.
.
.
.
.
.

ok this code work's

<?php
$ip = gethostbyname('www.example.com');

echo $ip;
?>

but how can' i make it to write in a box url?

commented: This will work +2
Member Avatar for diafol

Do you want an ajax solution or a traditional submit form? For Ajax - here's an idea - not meant as a full solution:

<div>
    <label for = "url">Enter URL:</label>
    <input id="url" />
    <button id="sendurl">Get IP</button>
</div>
<div id="ip">
</div>
<!-- or use a form instead of vanilla div -->

You can then use jquery or ordinary javascript to send the form data to a php page to do the gethostbyname() and return the data to the 'ip' div. Here's an example of jQuery.

At bottom of the page - before the </body> tag:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
$('#sendurl').click(function(){
    var urlText = $('#url').val();
    $.post("getIP.php", { url: urlText },
       function(data) {
         $('#ip').html(data);
       });
});
<script>

Your getIP.php file should accept the $_POST['url'] variable and then echo out the response to gethostbyname(). NOT TESTED.

woow man your good!
I was make few secoundss ago a page named "name1.php" i put the code inside and not works :(.

and watch out at the last line you forgot to close </script>

Member Avatar for diafol

Like I said NOT TESTED and not meant as a complete solution. It'll give you an idea. That's all. Up to you to implement it and play around with it - if you want to use it that is. Good luck.

hi,

I suggest you, one of the simple method to find the ip address of a website. To determine the ip address visit [Ip-details.com](http://www.ip-details.com/). This site contains the html code, which is used to get the ip address,isp,country etc. of a website. You can just embed/copy the code and implement to your website to view all the details of an ip.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.