What is my ip?
3.236.107.249
How to get my ip as plain text?
URL
http://requestbin.net/ip
cURL
curl -X POST -d "fizz=buzz" http://requestbin.net/ip
PowerShell
powershell -NoLogo -Command "(New-Object System.Net.WebClient).DownloadFile('http://requestbin.net/ip', 'C:\Windows\Temp\ip.txt')"
Python (with Requests)
import requests, time
r = requests.post('http://requestbin.net/ip', data={"ts":time.time()})
print r.status_code
print r.content
Node.js (with request)
var request = require('request');
var url ='http://requestbin.net/ip'
request(url, function (error, response, body) {
if (!error) {
console.log(body);
}
});
Ruby
require 'open-uri'
result = open('http://requestbin.net/ip')
result.lines { |f| f.each_line {|line| p line} }
C# / .NET
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace RequestBinExample
{
class Program
{
static void Main(string[] args)
{
MakeRequest();
}
private static async Task MakeRequest()
{
var httpClient = new HttpClient();
var response = await httpClient.GetAsync(new Uri("http://requestbin.net/ip"));
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
}
}
Java
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.params.HttpMethodParams;
import java.io.*;
public class RequestBinTutorial {
public static void main(String[] args) {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://requestbin.net/ip");
try {
int statusCode = client.executeMethod(method);
byte[] responseBody = method.getResponseBody();
System.out.println(new String(responseBody));
} catch (Exception e) {
System.err.println("Fatal error: " + e.getMessage());
e.printStackTrace();
} finally {
method.releaseConnection();
}
}
}
PHP
<?php
$result = file_get_contents('http://requestbin.net/ip');
echo $result;
?>