Bash

This article provides an example of using a proxy to make an HTTP request with the Bash programming language.

Friedrich Kräft avatar
Written by Friedrich Kräft
Updated over a week ago

Bash Code

In this example, we use the Residential proxy below:

resi.ipv6.plainproxies.com:8080:customer:product--resi6--pass--nicepass

This proxy is split into four parts separated by colons. We first save the proxy as a string variable, then split it into four parts at each colon (:) and then add it, with authentication, to our proxy dictionary.

#!/usr/bin/env bash
text="resi.ipv6.plainproxies.com:8080:customer:product--resi6--pass--nicepass"
IFS=':'
read -a proxy_parts <<< "$text"
ip_address=${proxy_parts[0]}
port=${proxy_parts[1]}
username=${proxy_parts[2]}
password=${proxy_parts[3]}
curl -x http://$username:$password@$ip_address:$port http://www.google.com/ && echo

Did this answer your question?