Search code examples
c#apihttpwebrequesturihttpwebresponse

HttpWebRequest No Response when calling an external website API


I am trying to use an API that helps detect bad IP, with C# code.

Here is the documentation.

How to call the API?

API requests are sent in a specific form. The API key is sent directly to the URL, as is the IP address from which you want to retrieve the information. This is the form of the URL called.

https://api.ipwarner.com/API-KEY/IP

According to this, I wrote a function:

private static string Get(string uri)
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
    HttpWebResponse response = (HttpWebResponse) request.GetResponse();
    Stream stream = response.GetResponseStream();
    StreamReader reader = new StreamReader(stream ?? throw new InvalidOperationException());
    return reader.ReadToEnd();
}

And called it with:

string myresult = Get("https://api.ipwarner.com/myapikey/myip");

However, it got stuck at HttpWebResponse. There was no response at all.

(I confirm my API key is available and the input IP is right)

How's that wrong?


Solution

  • It's not your problem i have checked it right now and the api is down

    you can also check

    https://www.isitdownrightnow.com/api.ipwarner.com.html

    i signed up the site and tested it my self the api site is down

    contact there support