Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6862055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:36:48+00:00 2026-05-27T02:36:48+00:00

I have used this code to open whatismyipaddress.com $fp = fsockopen(whatismyipaddress.com, 80, $errno, $errstr,

  • 0

I have used this code to open whatismyipaddress.com

$fp = fsockopen("whatismyipaddress.com", 80, $errno, $errstr, 5);

if ($fp) {
    $url = "/";

    fputs($fp, "GET $url HTTP/1.1\r\nHost: {whatismyipaddress.com}\r\nConnection: close\r\n\r\n");
    $resp = '';

    while(!feof($fp)) {
        $resp .= fgets($fp, 1024);
    }

    echo "$resp";
}

and i always can see this error

HTTP/1.1 301 Moved Permanently Date: Tue, 29 Nov 2011 20:19:36 GMT Server: Apache/2.2.17 (Unix) DAV/2 Location: http://whatismyipaddress.com/ MS-Author-Via: DAV Content-Length: 0 Connection: close Content-Type: text/html

Also i have used this code to open whatismyipaddress.com/proxy-check

$fp = fsockopen("whatismyipaddress.com", 80, $errno, $errstr, 5);

if ($fp) {
    $url = "/proxy-check";

    fputs($fp, "GET $url HTTP/1.1\r\nHost: {whatismyipaddress.com}\r\nConnection: close\r\n\r\n");
    $resp = '';

    while(!feof($fp)) {
        $resp .= fgets($fp, 1024);
    }

    echo "$resp";
}

and have this error

HTTP/1.1 404 Not Found Date: Tue, 29 Nov 2011 20:32:07 GMT Server: Apache/2.2.17 (Unix) DAV/2 Content-Length: 421 Connection: close Content-Type: text/html; charset=iso-8859-1
Not Found

The requested URL /proxy-check was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.17 (Unix) DAV/2 Server at {whatismyipaddress.com} Port 80

I’m sure, there is no any problem with the codes. i have tested it with many sites and i didn’t get any problem

Please can anyone explain this problem ?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:36:49+00:00Added an answer on May 27, 2026 at 2:36 am

    Basically your script works fine. There are some errors. One is specific to HTTP, see this line of code:

    fputs($fp, "GET $url HTTP/1.1\r\nHost: {whatismyipaddress.com}\r\nCon ...
                                           ^                     ^
    

    Remove those brackets, the HTTP protocol does not have any of those there, you need to provide a valid hostname. Solution:

    fputs($fp, "GET $url HTTP/1.1\r\nHost: whatismyipaddress.com\r\nCon ...
    

    Then the remote site will tell you need a user agent. Add it as an additional header:

    fputs($fp, "GET $url HTTP/1.1\r
    Host: whatismyipaddress.com\r
    Connection: close\r
    User-Agent: Florian der Fensterputzer\r\n\r\n");
    

    This will do it. Demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used code like this: http://msdn.microsoft.com/en-us/library/dw70f090.aspx to access database before when working in
I have used the following code to open the current page URL in Rich
I have used this code for extracting urls from web page.But in the line
I am creating a rails app and have used this code in one of
I have this code inside a class that is used by an application and
In our code we used to have something like this: *(controller->bigstruct) = ( struct
I have used an open source code from CodeProject to read email from incoming
I have used a js code to open a hyper link in a new
I have used this code var dest1 = File.AppendText(Path.Combine(_logFolderPath, log1.txt)); dest1.WriteLine(line.Trim()); to write to
I have used this piece of code for connecting to the database..It is showing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.