> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oculusproxies.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Your First Request

> Learn how to send your first request using Oculus Proxies products with easy-to-follow code examples in multiple programming languages.

To get started, you need your proxy credentials, your `Username`, `Password` along with the `Port`. You can find these credentials in the configured list.

## Code Examples

Once you have your proxy credentials, use the following code to send your first request:

```bash CURL theme={null}
curl --proxy "[login]-country-XX-\
session-YY:[password]@proxy.oculus-proxy.com:\
[port]" "http://httpbin.org/ip"
```

```bash Go theme={null}
package main

import (
    "fmt"
    "net/http"
    "net/url"
    "time"
    "io/ioutil"
    "encoding/json"
)

type IPResponse struct {
    Origin string `json:"origin"`
}

func testProxy(proxy *url.URL) {
    client := &http.Client{
        Transport: &http.Transport{
            Proxy: http.ProxyURL(proxy),
        },
        Timeout: 5 * time.Second,
    }
    resp, err := client.Get("http://httpbin.org/ip")
    if err != nil {
        fmt.Printf("Error occurred while testing proxy %s: %s\n", proxy.String(), err)
        return
    }
    defer resp.Body.Close()
    if resp.StatusCode == 200 {
        body, err := ioutil.ReadAll(resp.Body)
        if err != nil {
            fmt.Printf("Error reading response from proxy %s: %s\n", proxy.String(), err)
            return
        }
        var ipResp IPResponse
        if err := json.Unmarshal(body, &ipResp); err != nil {
            fmt.Printf("Error parsing JSON from proxy %s: %s\n", proxy.String(), err)
            return
        }
        fmt.Printf("Proxy %s is working. Your IP: %s\n", proxy.String(), ipResp.Origin)
    } else {
        fmt.Printf("Proxy %s returned status code %d\n", proxy.String(), resp.StatusCode)
    }
}

func main() {
    proxyStr := "http://[login]-country-XX-session-YY:[password]@proxy.oculus-proxy.com:[port]"
    proxyURL, err := url.Parse(proxyStr)
    if err != nil {
        fmt.Printf("Invalid proxy URL %s: %s\n", proxyStr, err)
    } else {
        testProxy(proxyURL)
    }
}

```

```bash NodeJS theme={null}
const axios = require('axios');

async function testProxy(proxy) {
    try {
        const response = await axios.get("http://httpbin.org/ip", {
            proxy,
            timeout: 5000
        });
        if (response.status === 200) {
            console.log(`Proxy %O is working. Your IP: ${response.data.origin}`, proxy);
        } else {
            console.log(`Proxy %O returned status code ${response.status}`, proxy);
        }
    } catch (error) {
        console.log(`Error occurred while testing proxy %O: ${error.message}`, proxy);
    }
}

async function main() {
    const proxy = {
        host: 'proxy.oculus-proxy.com',
        port: '[port]',
        auth: {username: '[login]-country-XX-session-YY', password: '[password]'},
    };
    await testProxy(proxy);
}

main();
```

```bash Python theme={null}
import requests

def test_proxy(proxy):
    try:
        response = requests.get("http://httpbin.org/ip", proxies={"http": proxy, "https": proxy}, timeout=5)
        if response.ok:
            print(f"Proxy {proxy} is working. Your IP: {response.json()['origin']}")
        else:
            print(f"Proxy {proxy} returned status code {response.status_code}")
    except Exception as e:
        print(f"Error occurred while testing proxy {proxy}: {e}")

def main():
    proxy = "http://[login]-country-XX-session-YY:[password]@proxy.oculus-proxy.com:[port]"
    test_proxy(proxy)

if __name__ == "__main__":
    main()
```

```bash PHP theme={null}
<?php

function testProxy($proxy) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://httpbin.org/ip");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    curl_setopt($ch, CURLOPT_PROXY, $proxy['host']);
    curl_setopt($ch, CURLOPT_PROXYPORT, $proxy['port']);
    curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy['login'] . ':' . $proxy['password']);
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($httpCode == 200) {
        $data = json_decode($response, true);
        echo "Proxy {$proxy['host']}:{$proxy['port']} is working. Your IP: {$data['origin']}\n";
    } else {
        echo "Proxy {$proxy['host']}:{$proxy['port']} returned status code $httpCode\n";
    }
    if (curl_errno($ch)) {
        echo 'Error occurred while testing proxy ' . "{$proxy['host']}:{$proxy['port']}: " . curl_error($ch) . "\n";
    }
    curl_close($ch);
}

function main() {
    $proxy = [
        'host' => 'proxy.oculus-proxy.com',
        'port' => '[port]',
        'login' => '[login]-country-XX-session-YY',
        'password' => '[password]',
    ];
    testProxy($proxy);
}

main();
?>

```

> [!NOTE]
>
> You can change country (For example `FR` for France) and the number of sessions (Enter the number of sessions you'd like) easily.
> Visit [here](https://docs.oculusproxies.com/proxy-networks/country-codes.md) to read more about country codes.

The code above uses the residential proxy to send a request to [http://httpbin.org/ip.](http://httpbin.org/ip.)

It returns your IP information:

```CURL theme={null}
{
  "origin": "1.2.3.4"
}
```

Now, replace [http://httpbin.org/ip](http://httpbin.org/ip) with the website of your choice and **that’s it!**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.