Skip to main content
title

What is Guzzle?

Guzzle is a PHP HTTP client library designed to make sending HTTP requests effortless. It handles everything from simple GET calls to complex request workflows. Instead of sending requests directly to the target server, your script routes them through our Oculus Proxies. When combined, this setup helps you:
  • Bypass IP bans and manage request rate limits.
  • Hide your original IP address for anonymity.
  • Access geo-restricted content for tasks like web scraping.
If you’re using Oculus to access search engines like Google, Bing, or Yandex and facing connection issues, the proxy type could be the reason. ISP Premium Proxies ensure stable and unrestricted access, preventing blocks that standard proxies might encounter. Switching to ISP Premium Proxies can help maintain smooth and reliable performance.

Setting Up Guzzle in Your PHP Project

1

Install PHP and Composer

Before starting, ensure you have PHP installed on your system. You will also need Composer, the package manager for PHP, which can be easily downloaded and installed. Make sure the php.exe (or equivalent) is correctly added to your system’s PATH.
2

Initialize the Project and Install Guzzle

  • Open your IDE and create a terminal in your project directory.
  • Run the following command to initialize your Composer project:
composer init
Follow the prompts, or skip them if you’re just testing.
  • Install Guzzle by running:
composer require guzzlehttp/guzzle
This command installs Guzzle and updates your composer.json file.
3

Run a Basic Request (Optional SSL Fix)

Create a basic PHP script to verify the Guzzle installation:
PHP
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;

$client = new Client([
    'verify' => false,  // Disable SSL verification for testing only
    'timeout' => 30,    // Increase timeout
]);

try {
    $response = $client->request('GET', 'https://oculusproxies.com/blog/proxy-solution-for-bulk-account-creation');
    echo $response->getBody()->getContents();
} catch (\GuzzleHttp\Exception\RequestException $e) {
    echo "Error: " . $e->getMessage();
    if ($e->hasResponse()) {
        echo "\nResponse: " . $e->getResponse()->getBody();
    }
}
Windows SSL Error Fix: If you encounter SSL errors, you may need to configure the certificate authority settings in your php.ini file.
  • Download the cURL certificate file and save it locally (e.g., C:\php\extras\ssl\cacert.pem).
  • Find your php.ini file location using php --ini in the terminal.
  • Open php.ini, uncomment, and set the following two lines to your certificate path:
curl.cainfo = C:\path\to\cacert.pem
openssl.cafile = C:\path\to\cacert.pem
4

Configure Guzzle with an Oculus Proxies Proxy

Add a proxy option to your Guzzle request to route your traffic through your Oculus Proxies proxy.Include your credentials directly in the proxy URL:
PHP
<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client();

$response = $client->request('GET', 'https://iproyal.com/blog/industry-news-2', [
    'proxy' => 'http://[username]:[password]@proxy.oculus-proxy.com:31113',
]);

echo $response->getBody()->getContents();
Replace [username]:[password] with your actual Oculus Proxies details.

Troubleshooting Guzzle Proxy Issues

Proxies can occasionally lead to errors. Here are solutions for common problems:
  • Timeout Errors: Your proxy may be slow or offline. Solution: Try a different proxy from your Oculus Proxies dashboard, or increase the 'timeout' option in the Guzzle client.
  • Authentication Errors (e.g., HTTP 407): The credentials in the proxy string are incorrect. Solution: Carefully check your username and password for typos.
  • IP Blocks or Bans: The target website detected and blocked the IP address. Solution: Utilize Oculus Proxies’s rotating proxies to ensure your IP address changes frequently with each request, minimizing the chance of bans.
  Best Practice: Always test your Guzzle proxy setup with a neutral endpoint (like https://httpbin.org/ip) to confirm your proxy IP is being used successfully before attempting to scrape a target site.