From 3cf406a30bc7bf0eca685cb8c4abd6e053457187 Mon Sep 17 00:00:00 2001 From: evomi-admin Date: Sun, 14 Jul 2024 15:52:59 +0000 Subject: [PATCH] evomi.com --- README.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++ csharp-example.cs | 47 +++++++++++++++++++++++++++++ curl-example.sh | 15 +++++++++ go-example.go | 54 +++++++++++++++++++++++++++++++++ java-example.java | 55 +++++++++++++++++++++++++++++++++ nodejs-example.js | 30 ++++++++++++++++++ php-example.php | 34 +++++++++++++++++++++ python-example.py | 26 ++++++++++++++++ 8 files changed, 338 insertions(+) create mode 100644 README.md create mode 100644 csharp-example.cs create mode 100644 curl-example.sh create mode 100644 go-example.go create mode 100644 java-example.java create mode 100644 nodejs-example.js create mode 100644 php-example.php create mode 100644 python-example.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..ad3b86d --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +# Residential Proxies + +[![Evomi Residential Proxies Banner](https://my.evomi.com/images/brand/cta.png)](https://my.evomi.com) + +Welcome to Evomi's Residential Proxies repository! This project demonstrates how to use our high-quality residential proxies in various programming languages. + +## What are Residential Proxies? + + +Residential proxies are IP addresses provided by Internet Service Providers (ISPs) to homeowners. When you use our residential proxies, your requests appear to come from real residential locations, providing better anonymity and reducing the chance of being blocked by websites. + +## Getting Started + +Before running any of the example scripts, you need to set up your credentials: + +```bash +export proxy_username=your_username +export proxy_password=your_password +``` + +Replace `your_username` and `your_password` with the credentials provided by Evomi. + +## Usage Examples + +We provide example scripts in 6 different programming languages to help you get started quickly: + +### cURL +```bash +curl -x rp.evomi.com:1000 -U "${proxy_username}:${proxy_password}" https://ip.evomi.com/s +``` + +### Python +```bash +python python_example.py +``` + +### Node.js +```bash +node nodejs_example.js +``` + +### PHP +```bash +php php_example.php +``` + +### Go +```bash +go run go_example.go +``` + +### Java +```bash +javac JavaExample.java +java JavaExample +``` + +### C# +```bash +dotnet run +``` + +## Features + +- High-quality residential IP addresses +- Free Trial +- Based in Switzerland +- Worldwide locations +- Excellent success rates +- 24/7 customer support +- Flexible pricing plans + +## Support + +If you encounter any issues or have questions, please don't hesitate to contact our support team at hello@evomi.com or via our live-chat. + + diff --git a/csharp-example.cs b/csharp-example.cs new file mode 100644 index 0000000..3bbd3fa --- /dev/null +++ b/csharp-example.cs @@ -0,0 +1,47 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; + +class CSharpExample +{ + static async Task Main(string[] args) + { + string proxyUsername = Environment.GetEnvironmentVariable("proxy_username"); + string proxyPassword = Environment.GetEnvironmentVariable("proxy_password"); + + if (string.IsNullOrEmpty(proxyUsername) || string.IsNullOrEmpty(proxyPassword)) + { + Console.WriteLine("Error: Proxy credentials not set. Please set proxy_username and proxy_password."); + Console.WriteLine("Example:"); + Console.WriteLine("export proxy_username=your_username"); + Console.WriteLine("export proxy_password=your_password"); + Environment.Exit(1); + } + + try + { + var proxy = new WebProxy + { + Address = new Uri($"http://rp.evomi.com:1000"), + Credentials = new NetworkCredential($"customer-{proxyUsername}", proxyPassword) + }; + + var handler = new HttpClientHandler + { + Proxy = proxy, + UseProxy = true, + }; + + using (var client = new HttpClient(handler)) + { + var response = await client.GetStringAsync("https://ip.evomi.com/"); + Console.WriteLine(response); + } + } + catch (Exception e) + { + Console.WriteLine($"An error occurred: {e.Message}"); + } + } +} diff --git a/curl-example.sh b/curl-example.sh new file mode 100644 index 0000000..138674e --- /dev/null +++ b/curl-example.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Ensure that proxy credentials are set +if [ -z "$proxy_username" ] || [ -z "$proxy_password" ]; then + echo "Error: Proxy credentials not set. Please set proxy_username and proxy_password." + echo "Example:" + echo "export proxy_username=your_username" + echo "export proxy_password=your_password" + exit 1 +fi + +# Use curl to make a request through the proxy +curl -x rp.evomi.com:1000 -U "${proxy_username}:${proxy_password}" https://ip.evomi.com/s + +# Note: This will output the response from ip.evomi.com, which should show the IP address being used diff --git a/go-example.go b/go-example.go new file mode 100644 index 0000000..c199f1f --- /dev/null +++ b/go-example.go @@ -0,0 +1,54 @@ +package main + +import ( + "fmt" + "io/ioutil" + "net/http" + "net/url" + "os" +) + +func main() { + // Get proxy credentials from environment variables + proxyUsername := os.Getenv("proxy_username") + proxyPassword := os.Getenv("proxy_password") + + if proxyUsername == "" || proxyPassword == "" { + fmt.Println("Error: Proxy credentials not set. Please set proxy_username and proxy_password.") + fmt.Println("Example:") + fmt.Println("export proxy_username=your_username") + fmt.Println("export proxy_password=your_password") + os.Exit(1) + } + + // Set up the proxy URL + proxyURL, err := url.Parse(fmt.Sprintf("http://customer-%s:%s@rp.evomi.com:1000", proxyUsername, proxyPassword)) + if err != nil { + fmt.Println("Error parsing proxy URL:", err) + return + } + + // Create a new HTTP client with the proxy + client := &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + }, + } + + // Make a request through the proxy + resp, err := client.Get("https://ip.evomi.com/") + if err != nil { + fmt.Println("Error making request:", err) + return + } + defer resp.Body.Close() + + // Read and print the response + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + fmt.Println("Error reading response:", err) + return + } + + fmt.Println(string(body)) +} diff --git a/java-example.java b/java-example.java new file mode 100644 index 0000000..d486f78 --- /dev/null +++ b/java-example.java @@ -0,0 +1,55 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.Authenticator; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.PasswordAuthentication; +import java.net.Proxy; +import java.net.URL; + +public class JavaExample { + public static void main(String[] args) { + String proxyUsername = System.getenv("proxy_username"); + String proxyPassword = System.getenv("proxy_password"); + + if (proxyUsername == null || proxyPassword == null) { + System.out.println("Error: Proxy credentials not set. Please set proxy_username and proxy_password."); + System.out.println("Example:"); + System.out.println("export proxy_username=your_username"); + System.out.println("export proxy_password=your_password"); + System.exit(1); + } + + try { + // Set up the proxy + Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("rp.evomi.com", 1000)); + + // Set up the authenticator + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication("customer-" + proxyUsername, proxyPassword.toCharArray()); + } + }); + + // Create the connection + URL url = new URL("https://ip.evomi.com/"); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy); + + // Read the response + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String inputLine; + StringBuilder content = new StringBuilder(); + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + in.close(); + + // Print the response + System.out.println(content.toString()); + + } catch (Exception e) { + System.out.println("An error occurred: " + e.getMessage()); + } + } +} diff --git a/nodejs-example.js b/nodejs-example.js new file mode 100644 index 0000000..96adaf3 --- /dev/null +++ b/nodejs-example.js @@ -0,0 +1,30 @@ +const axios = require('axios'); + +// Get proxy credentials from environment variables +const proxyUsername = process.env.proxy_username; +const proxyPassword = process.env.proxy_password; + +if (!proxyUsername || !proxyPassword) { + console.error("Error: Proxy credentials not set. Please set proxy_username and proxy_password."); + console.error("Example:"); + console.error("export proxy_username=your_username"); + console.error("export proxy_password=your_password"); + process.exit(1); +} + +const proxy = { + host: 'rp.evomi.com', + port: 1000, + auth: { + username: `customer-${proxyUsername}`, + password: proxyPassword + } +}; + +axios.get('https://ip.evomi.com/', { proxy }) + .then(response => { + console.log(response.data); + }) + .catch(error => { + console.error('An error occurred:', error.message); + }); diff --git a/php-example.php b/php-example.php new file mode 100644 index 0000000..f03263e --- /dev/null +++ b/php-example.php @@ -0,0 +1,34 @@ +