title: Get IP-address by URL
body: <p>This works</p>
  
  <pre><code>target.sin_addr.s_addr = inet_addr("127.0.0.1");
  </code></pre>
  
  <p>but I want to put the IP from a website URL</p>
  
  <p>I have tried</p>
  
  <pre><code>const char host[] = "http://www.google.com/";
  struct hostent *host_ip;
  host_ip = gethostbyaddr(host, strlen(host), 0);
  </code></pre>
  
  <p>I of corse did WSAStartup before I used gethostbyaddr();</p>
  
  <p>I've tried this</p>
  
  <pre><code>target.sin_addr.s_addr = inet_addr(host_ip);
  </code></pre>
  
  <p>I've tried a few simmilar ones too but it isn't working.
  Could someone show me how to do this correctly.</p>
  
  <p>Thank you!</p>
  
  <p>EDIT:</p>
  
  <p>When I do</p>
  
  <pre><code>host_ip = gethostbyaddr((char *)&amp;host, strlen(host), 0);
  std::cout &lt;&lt; host_ip-&gt;h_addr;
  </code></pre>
  
  <p>It gives me</p>
  
  <pre><code>httpa104-116-116-112.deploy.static.akamaitechnologies.com
  </code></pre>