Instantiable (non-static) PHP class that allows for easy curling of addresses, taking into consideration acceptable mime types, http auth, response sizes and cookie storing.
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
maps
src
tmp Huge revamp of Curler to make error handling cleaner and able to hand… May 16, 2016
.gitignore .gitignore file addition Jul 25, 2012
LICENSE
README.md Docs May 16, 2016

README.md

PHP-Curler

This library was many years in the making for me. While it's usage is limited (eg. currently only supports get, post and head requests), it's focused around the ability to quickly specify a resource to pull, and depending on it's meta details (eg. how big the document is, what mime types it claims itself as), proceed with the requests.

Whether or not a url is accepted can be controlled through the following methods

  • setMime set the acceptable mime type
  • setMimes set the acceptable mime types

Information about a cURL request's error can be accessed through the getErrors method. Additionally, raw information about the request can be accessed through the getInfo method.

Example Output of a URL

<?php

    // booting
    require_once APP . '/vendors/PHP-Curler/src/Curler.class.php';
    
    // grab google.com contents and display
    $curler = new Curler();
    echo $curler->get('http://www.google.com/');
    exit(0);

The above example, quite simply, downloads the google.com source, and displays it. By default, every new Curler instance is configured to accept documents whose mime type falls into the category of 'webpage' (which includes the mime types application/xhtml+xml and text/html).