Skip to content

Commit

Permalink
evomi.com
Browse files Browse the repository at this point in the history
  • Loading branch information
evomi-admin committed Jul 14, 2024
0 parents commit 3cf406a
Show file tree
Hide file tree
Showing 8 changed files with 338 additions and 0 deletions.
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 [email protected] or via our live-chat.


47 changes: 47 additions & 0 deletions csharp-example.cs
Original file line number Diff line number Diff line change
@@ -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}");
}
}
}
15 changes: 15 additions & 0 deletions curl-example.sh
Original file line number Diff line number Diff line change
@@ -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
54 changes: 54 additions & 0 deletions go-example.go
Original file line number Diff line number Diff line change
@@ -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:%[email protected]: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))
}
55 changes: 55 additions & 0 deletions java-example.java
Original file line number Diff line number Diff line change
@@ -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());
}
}
}
30 changes: 30 additions & 0 deletions nodejs-example.js
Original file line number Diff line number Diff line change
@@ -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);
});
34 changes: 34 additions & 0 deletions php-example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

// Get proxy credentials from environment variables
$proxyUsername = getenv('proxy_username');
$proxyPassword = getenv('proxy_password');

if (!$proxyUsername || !$proxyPassword) {
echo "Error: Proxy credentials not set. Please set proxy_username and proxy_password.\n";
echo "Example:\n";
echo "export proxy_username=your_username\n";
echo "export proxy_password=your_password\n";
exit(1);
}

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, "https://ip.evomi.com/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, "rp.evomi.com:1000");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "customer-$proxyUsername:$proxyPassword");

// Execute cURL request
$response = curl_exec($ch);

if ($response === false) {
echo "cURL Error: " . curl_error($ch);
} else {
echo $response;
}

// Close cURL session
curl_close($ch);
26 changes: 26 additions & 0 deletions python-example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
import requests

# Get proxy credentials from environment variables
proxy_username = os.environ.get('proxy_username')
proxy_password = os.environ.get('proxy_password')

if not proxy_username or not proxy_password:
print("Error: Proxy credentials not set. Please set proxy_username and proxy_password.")
print("Example:")
print("export proxy_username=your_username")
print("export proxy_password=your_password")
exit(1)

# Set up the proxy
proxy = {
"http": f"http://customer-{proxy_username}:{proxy_password}@rp.evomi.com:1000",
"https": f"http://customer-{proxy_username}:{proxy_password}@rp.evomi.com:1000"
}

try:
# Make a request through the proxy
response = requests.get("https://ip.evomi.com/", proxies=proxy)
print(response.text)
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")

0 comments on commit 3cf406a

Please sign in to comment.