What Is My IP Address? - IP Address Lookup, Bandwidth Speed Test, IP Info, plus more

Go Back   What Is My IP Forum > All About Code > Coding Problems

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2009, 03:39 PM
execretor execretor is offline
Junior Member
 
Join Date: May 2009
Posts: 1
Default Get IP with Socket & C++

I use that strings:

const char * IP = "www.whatismyip.com";
const char * PAGE = "/automation/n09230945.asp";

I use this command:

GET /automation/n09230945.asp HTTP/1.1
Host: GetHtml
User-Agent: Phoenix Software
Connection: Close

but I receive that:

HTTP/1.1 301 Moved Permanently
Connection: close
Date: Tue, 05 May 2009 18:36:57 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: http://verycurious.com/catchall-erro...length-gethtml
Cache-Control: private
Content-Length: 0

ıııııııııııııııııııııııııııııııııııııııııııııııııı ı
ıııııııııııııııııııııııııııııııııııııııııııııııııı ı
ıııııııııııııııııııııııııııııııııııııııııııııııııı ı
ıııııııııııııııııııııııııııııııııııııııııııııııııı ı
ıııııııııııııııııııııııııııııııııııııııııııııııııı ı
ıııııııııııııııııııııııııııııııııııııııııııııııııı ı
ıııııııııııııııııııııııııııııııııııııııııııııııııı ı
ıııııııııııııııııııııııııııııııııııııııııııııııııı ı
Reply With Quote
  #2  
Old 05-09-2009, 09:31 AM
wimiadmin's Avatar
wimiadmin wimiadmin is offline
Administrator
 
Join Date: May 2008
Location: Pigeon Forge, TN
Posts: 529
Default

Try going straight to the automation page.

http://www.whatismyip.com/automation/n09230945.asp

Let me know what happens.
__________________
Brian
Please Search Before Posting
Reply With Quote
  #3  
Old 05-12-2009, 01:04 AM
clanmills's Avatar
clanmills clanmills is offline
Super Moderator
 
Join Date: Jul 2008
Location: San Jose, CA
Posts: 103
Send a message via MSN to clanmills Send a message via Skype™ to clanmills
Default

Brian's right (he usually is of course) - go straight to the page.

I'm a little surprised by this and I haven't been able to reproduce this with curl and TcpTunnel. curl is very useful for doing GETs (and other stuff) from the command line. And TcpTunnel's a simple "pipe" with which you can see what's going over the wire.

http://www.vakuumverpackt.de/tcptunnel/

So if you do:
java TcpTunnelGui 9000 www.whatismyip.com 80

then

curl http://localhost:9000/automation/

You'll see the HTTP to the server as:
Quote:
GET /automation/n09230945.asp HTTP/1.1
User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
Host: localhost:9000
Accept: */*
and the reply is:

Quote:
HTTP/1.1 200 OK
Date: Tue, 12 May 2009 03:50:36 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 375

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>VERYCURIOUS.COM</title>
</head>
<body>
<iframe height="1070" width="100%" scrolling="auto" frameborder="0" src="http://www.odvy.com/index.php?d=verycurious.com&c=2225"></iframe>
</body>
</html>
I get a '200' which is normal. '301' is a redirect. Many httpget utilities (including curl) automatically handle a 301 automatically.

I hope this is useful to you.

Robin
Reply With Quote
  #4  
Old 05-13-2009, 12:47 PM
Jim Jim is offline
Administrator
 
Join Date: Jul 2008
Posts: 2
Default

I think you have your command wrong. You're sending "GetHtml" as the host to the server which isn't being found. Then you get the redirect.

Quote:
Originally Posted by execretor View Post
GET /automation/n09230945.asp HTTP/1.1
Host: GetHtml
User-Agent: Phoenix Software
Connection: Close
Change the host to "whatismyip.com" and it should work.

Quote:
GET /automation/n09230945.asp HTTP/1.1
Host: whatismyip.com
User-Agent: Phoenix Software
Connection: Close
Jim
Reply With Quote
  #5  
Old 05-13-2009, 11:00 PM
clanmills's Avatar
clanmills clanmills is offline
Super Moderator
 
Join Date: Jul 2008
Location: San Jose, CA
Posts: 103
Send a message via MSN to clanmills Send a message via Skype™ to clanmills
Default

Jim

You are 100% correct. Thanks.

Robin
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 12:07 PM.


What Is My IP - IP Command Lines - What is an IP Address - Speed Test - IP Address FAQ

Need IP address location detection service? Get it from IP2Location.com now.

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright - WhatIsMyIP.com