Installation

When you sign up you will be provided with a unique username and password and a connection string that you can use when configuring your proxy service in your application:  

http://username:[email protected]:9293

  

All requests that you make via this proxy will appear to the destination server to originate from one of the two static IPs you will be assigned when you sign up.


We recommend you store the connection string in an environment variable STATICA_URL. If you have signed up via the add-ons platform on Heroku or cloudControl this variable will be automatically set in your production environment.


Integration

This example is written in C# and uses the HttpWebRequest class to make a request via Statica.


 

//Extract proxy connection details
string proxyUrl = Environment.GetEnvironmentVariable("STATICA_URL");
System.Uri proxyUri = new System.Uri(url);
string cleanProxyURL = uri.Scheme + "://" + uri.Host+":"+uri.Port;
string user = uri.UserInfo.Split(':')[0]
string password = uri.UserInfo.Split(':')[1]
HttpWebRequest request = (HttpWebRequest) WebRequest.Create("http://ip.jsontest.com/");
WebProxy myProxy = new WebProxy();
Uri newUri = new Uri(cleanProxyURL);
// Associate the newUri object to 'myProxy' object so that new myProxy settings can be set.
myProxy.Address = newUri;
// Create a NetworkCredential object and associate it with the 
// Proxy property of request object.
myProxy.Credentials = new NetworkCredential(user, password);
request.Proxy = myProxy;

HttpWebResponse httpWebResponse = request.GetResponse() as HttpWebResponse;
// Get the stream containing content returned by the server.
Stream dataStream = httpWebResponse.GetResponseStream();

// Open the stream using a StreamReader for easy access.
StreamReader streamReader = new StreamReader(dataStream);

// Read the content.
String responseFromServer = streamReader.ReadToEnd();

// Write the content.
Console.WriteLine(responseFromServer);

streamReader.Close();
dataStream.Close();