How to scrape using Guzzle, Simple HTML Dom and anyIP.io?

Updated April 2, 2025 1 min read

Table of Contents

Key takeaways

  • Guzzle is a PHP library used for web scraping, installed via Composer.

  • Use Guzzle for requests and add a proxy with the "proxy" parameter.

  • Check response status and headers before parsing HTML content.

  • Simple HTML Dom allows using CSS selectors to parse content.

  • Rotating proxies from anyIP.io enhance web scraping effectiveness.

In this quick tutorial, we will show you how to start to scrape any website using Guzzle (a PHP library) and using rotating proxies from anyIP.io, get your account now.

For scraping jobs that need cleaner IP reputation, residential proxies help requests look closer to real user traffic.

Guzzle installation

The recommended way to install Guzzle is through Composer.

Bash
composer require guzzlehttp/guzzle

How to use Guzzle

Following the documentation, opening a page using Guzzle is pretty simple:

PHP
$client = new GuzzleHttpClient(); 
$res = $client->request('GET', 'https://www.example.com'); 
echo $res->getBody();

To use a proxy, you have to add a proxy parameter:

PHP
$res = $client->request("POST", "https://www.example.com", [ 
  "proxy" => "https://username:password@portal.anyip.io", 
]);

How to parse the page?

The content of the page is in $res->getBody(). After checking that you actually got the correct result (the status code is 200, the content header is text or similar, etc.), you can start to parse the page. They are many options for this:

As a quick introduction to the scraping world, we will use Simple HTML Dom. After installing it and initialize it, you can simply use any CSS selector to retrieve the content of your choice:

PHP
$simpleHTMLDom = str_get_html($res->getBody()); 
$links = $simpleHTMLDom ->find('a');

Article by

Khaled Bentoumi

Khaled is a software engineer. He's been involved in many startups of different sizes. Previously, he founded Data to Page, an AI Programmatic SEO startup. He now handles all the marketing at anyIP.

Khaled Bentoumi

Read more

July 22, 2026

What Is a UDP Proxy? A Practical Guide for Real-Time Traffic

Understand what is UDP proxy server by exploring the main differences from TCP and HTTP proxies and learning how to use UDP proxies in practice.

Khaled Bentoumi
Khaled Bentoumi
October 20, 2025

Mobile vs. Datacenter Proxies: 4 Key Differences

Learn about the differences between mobile and datacenter proxies, when to use them, and tips for choosing the right one in this anyIP guide.

Khaled Bentoumi
Khaled Bentoumi
October 17, 2025

ISP vs. Residential Proxies: 7 Key Differences

Looking for the best proxy solution? Learn the 7 key differences between ISP and Residential Proxies with anyIP.

Khaled Bentoumi
Khaled Bentoumi

Ready for Next-Level Proxy Solutions?

Get started now and experience the ultimate in proxy flexibility, speed, and security.