Download the PHP package kelvinzer0/curl-impersonate-php without Composer

On this page you can find all versions of the php package kelvinzer0/curl-impersonate-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
kelvinzer0/curl-impersonate-php
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package curl-impersonate-php

Curl-Impersonate-PHP

Curl-Impersonate-PHP is a library that allows the execution of HTTP requests using cURL within the PHP environment with the ability to emulate the behavior of four major browsers (Chrome, Firefox, Safari, and Microsoft Edge).

Description

Curl-Impersonate-PHP is an implementation of the original project Curl-Impersonate, available at https://github.com/lwthiker/curl-impersonate, which introduces a specialized cURL build that can mimic the behavior of four major browsers. By using Curl-Impersonate-PHP, you can make HTTP requests from PHP using cURL but with headers and behavior that resemble Chrome, Firefox, Safari, or Microsoft Edge.

Key Features

Installation

You can install Curl-Impersonate-PHP using Composer. Run the following command in your project directory:

Usage

Below is an example of using Curl-Impersonate-PHP to make an HTTP request while emulating the behavior of a browser:

Be sure to replace the value of the CURLCMDOPT_URL option with the appropriate target URL and set the browser impersonation according to your needs.

setopt Function

The setopt function is used to set options in the HTTP request that will be executed using cURL. Here is a list of options supported by the setopt function:

Option Description
CURLCMDOPT_URL Sets the target URL for the HTTP request.
CURLCMDOPT_METHOD Sets the HTTP method to be used (e.g., GET, POST, PUT, etc.).
CURLCMDOPT_POSTFIELDS Sets the data to be sent as the request body (can be in the form of an array or object, will be converted to JSON).
CURLCMDOPT_HTTP_HEADERS Sets the HTTP headers in the form of an array for the request.
CURLCMDOPT_HEADER Sets whether the response will include headers or not (boolean).
CURLCMDOPT_COOKIEFILE Sets the path to the file containing cookies for the request.
CURLCMDOPT_COOKIEJAR Sets the path to the file to store cookies received from the response.
CURLCMDOPT_ENGINE Sets the cURL engine to be used for request execution (e.g., "curl", etc.).

Streaming Usage

In addition to supporting getting the standard output of HTTP request execution, Curl-Impersonate-PHP also provides the ability to stream (retrieve data in chunks) the response from an ongoing HTTP request. You can use the streaming feature with the following steps:

  1. Enable Streaming: Call the execStream function to enable streaming before starting the HTTP request:

  2. Retrieve Data in Chunks: You can use the readStream function to retrieve response data in chunks of the specified size:

  3. Close Streaming: After you finish using streaming, be sure to close it by calling the closeStream function:

Example of Streaming Usage

Here's a complete example of using streaming in Curl-Impersonate-PHP:

Be sure to replace the value of CURLCMDOPT_URL with the appropriate target URL and set the browser impersonation according to your needs. Streaming is particularly useful for handling large responses or responses that need to be processed in specific chunks sequentially.

Contributions

If you would like to contribute to Curl-Impersonate-PHP, we greatly appreciate your contributions. Please open a new issue or submit a pull request on our GitHub repository.

License

Curl-Impersonate-PHP is licensed under the MIT License, which means you are free to use, modify, and distribute this library according to the terms of the license.


All versions of curl-impersonate-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kelvinzer0/curl-impersonate-php contains the following files

Loading the files please wait ....