Want to route your request via a specific country's IP? It's simple with HomeIP. Just add the country
flag to your authorization header.
This flag accepts the country's two-letter 3166-1 alpha-2 code, and it's case insensitive. So, whether you type 'DE' or 'de', you'll route through a German proxy.\
Examples :
Germany : Use the code DE
or de
.
United Kingdom : Opt for GB
or gb
.
Thailand : Specify with TH
or th
.
Check out the provided examples to see how you can seamlessly incorporate this in your requests.
To make a request to ip.homeip.io
using a random IP address from Germany, you would use the country
flag with the country code for Germany (DE
):
cURL PHP Python Java C# Ruby
Copy curl -x pr.homeip.io:7777 -U "username=USERNAME+country=de:PASSWORD" http://ip.homeip.io
Copy <? php
$username = 'USERNAME' ;
$password = 'PASSWORD' ;
$country = 'DE' ;
$proxy = 'pr.homeip.io:7777' ;
$query = curl_init ( 'http://ip.homeip.io' ) ;
curl_setopt ( $query , CURLOPT_RETURNTRANSFER , 1 ) ;
curl_setopt ( $query , CURLOPT_PROXY , "http://$proxy" ) ;
curl_setopt ( $query , CURLOPT_PROXYUSERPWD , "username=$username+country=$country:$password" ) ;
$output = curl_exec ( $query ) ;
curl_close ( $query ) ;
if ($output)
echo $output;
?>
Copy import urllib . request
import random
username = 'USERNAME'
password = 'PASSWORD'
country = 'DE'
entry = ( 'http://username= %s +country= %s : %s @pr.homeip.io:7777' %
(username , country , password))
query = urllib . request . ProxyHandler ({
'http' : entry,
'https' : entry,
})
execute = urllib . request . build_opener (query)
print (execute. open ( 'http://ip.homeip.io' ). read ())
Copy package example ;
import org . apache . http . HttpHost ;
import org . apache . http . client . fluent . * ;
public class Example {
public static void main ( String [] args) throws Exception {
HttpHost entry = new HttpHost( "pr.homeip.io" , 7777 ) ;
String query = Executor . newInstance ()
. auth (entry , "username=USERNAME+country=DE" , "PASS" )
. execute ( Request . Get ( "http://ip.homeip.io" ) . viaProxy (entry))
. returnContent () . asString ();
System . out . println (query);
}
}
Copy using System ;
using System . Net ;
class Example
{
static void Main ()
{
var client = new WebClient ();
client . Proxy = new WebProxy ( "pr.homeip.io:7777" );
client . Proxy . Credentials = new NetworkCredential ( "username=USERNAME+country=DE" , "PASSWORD" );
Console . WriteLine ( client . DownloadString ( "https://ip.homeip.io" ));
}
}
Copy require 'uri'
require 'net/http'
uri = URI . parse( 'http://ip.homeip.io/' )
proxy = Net :: HTTP :: Proxy ( 'pr.homeip.io' , 7777 , 'username=USERNAME+country=DE' , 'PASSWORD' )
req = Net :: HTTP :: Get . new (uri . path)
result = proxy . start(uri . host , uri . port) do | http |
http . request(req)
end
puts result . body
Last updated 11 months ago