Skip to content


MIT 705 14 104,250
205.1 million (month) Aug 29 2014 1.7.2(5 days ago)
22,795 13 31 MIT
Nov 14 2011 448.0 thousand (month) 7.8.0(8 months ago)

axios is a popular JavaScript library that allows you to make HTTP requests from a Node.js environment. It is a promise-based library that works in both the browser and Node.js. It is similar to the Fetch API, but with a more powerful feature set and better browser compatibility.

One of the main benefits of using axios is that it automatically transforms the response data into a JSON object, making it easy to work with.

Axios is known for user-friendly API and support for asynchronous async/await syntax making it very accessible in web scraping.

Guzzle is a PHP HTTP client library that makes it easy to send HTTP requests and trivial to integrate with web services. It allows you to send HTTP/1.1 requests with various methods like GET, POST, PUT, DELETE, and others.

Guzzle also supports sending both synchronous and asynchronous requests, caching, and even has built-in support for OAuth 1.0a. Additionally, it can handle different HTTP errors and handle redirects automatically. It also has built-in support for serializing and deserializing data using formats like JSON and XML, as well as sending multipart file uploads.

Overall Guzzle is an easy to use and powerful library for working with HTTP in PHP.

Example Use

// axios can be used with promises:
  .then(response => {
  .catch(error => {

// or async await syntax:
var resp = await axios.get('');

// to make requests concurrently Promise.all function can be used:
const results = await Promise.all([

// axios also supports other type of requests like POST and even automatically serialize them:
await'', {'query': 'hello world'});
// or formdata
const data = {name: 'John Doe', email: ''};

        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'

// default values like headers can be configured globally
axios.defaults.headers.common['User-Agent'] = '';
// or for session instance:
const instance = axios.create({
  headers: {"User-Agent": ""},
use GuzzleHttp\Client;

// Create a client session:
$client = new Client();
// can also set session details like headers
$client = new Client([
    'headers' => [
        'User-Agent' => '',

// GET request:
$response = $client->get('');
// print all details
// or the important bits
printf("status: %s\n", $response->getStatusCode());
printf("headers: %s\n", json_encode($response->getHeaders(), JSON_PRETTY_PRINT));
printf("body: %s", $response->getBody()->getContents());

// POST request
$response = $client->post(
// for JSON use json argument:
    ['json' => ['query' => 'foobar', 'page' => 2]]
// or formdata use form_params:
//  ['form_params' => ['query' => 'foobar', 'page' => 2]]

// For ASYNC requests getAsync function can be used:
$promise1 = $client->getAsync('');
$promise2 = $client->getAsync('');
// await it:
$results = Promise\unwrap([$promise1, $promise2]);
foreach ($results as $result) {
    echo $result->getBody();
// or add promise callback
Promise\each([$promise1, $promise2], function ($response, $index, $callable) {
    echo $response->getBody();

Alternatives / Similar

Was this page helpful?