Download the PHP package dcarbone/curl-header-extractor without Composer

On this page you can find all versions of the php package dcarbone/curl-header-extractor. 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?

Informations about the package curl-header-extractor

curl-header-extractor

Utility to extract headers from PHP CURL request.

Installation

While it is advisable to use Composer, this lib is simple enough to be used without it.

Composer Require entry:

Usage

There are 3 methods available:

getHeaderAndBody

This method accepts a single argument that may be:

The response will be an array with the following structure:

Example:

where $headers will be an array of headers, or NULL if no headers were found, and $body will be the entire contents of the body.

Note:

This method CAN be very expensive to use if you are working with particularly large responses, as the end result will be the entire contents of the file loaded into memory.

If you wish to extract JUST the headers, the below methods might serve you better.

extractHeadersAndBodyStartOffset

This method will return an array with the following structure:

Example:

If no headers were seen in the file, $headers in the above example will be NULL and the byte offset will be 0.

removeHeadersAndMoveFile

This method will strip the file of the headers, copy the body to a new file, and then delete the old file.

Example:

If you executed the extractHeadersAndBodyStartOffset method already, you may pass in the body start offset integer in as the 3rd argument.

Invoking

To make this class easier to work with as a "helper", it implements the PHP magic method __invoke (you can see the implementation here).

This allows you to do something like this:

You can, of course, access the other methods as you normally would any static method:


All versions of curl-header-extractor with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-mbstring Version *
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 dcarbone/curl-header-extractor contains the following files

Loading the files please wait ....