pagemunch/pagemunch

A PHP wrapper for the PageMunch link unfurling API

dev-master 2016-12-31 07:19 UTC

This package is not auto-updated.

Last update: 2024-06-05 10:04:09 UTC


README

Introduction

PageMunch is a simple API backed by an intelligent web crawler, that lets you extract data from any webpage on the internet in milliseconds. Whether you want to grab the best title, description and image for a page, prices, authorship, enable video embeds or more. We make it crazy easy to treat the web like a database.

Installation

You can install the PHP module using Composer, simply add it to your requirements, for example:

{
    "require": {
        "PageMunch/PageMunch": ">=1.0.0"
    }
}

Or clone the repository directly from GitHub and use the class in the vendors directory of your Framework or elsewhere.

Usage

// if using Composer then you should use an autoloader, otherwise require the
// file however you might normally
require('src/PageMunch/PageMunch.php');
use PageMunch\PageMunch;

// create a new API object to use for requests - your API key from the PageMunch
// account dashboard should be passed in here. We recommend using an environment
// variable to make distributing code between environments easier and more secure
$api = new PageMunch(array('key' => getenv('PAGEMUNCH_API_KEY')));

$response = $api->extract('http://www.youtube.com/watch?v=9bZkp7q19f0');

// check if the API call succeeded and output the title from the response data
if ($response) {
	print_r($response->title);
} else {
	print_r($api->getError()->message);
}

More Details

For more information, libraries and documentation check out the PageMunch Documentation

License

This module is Copyright PageMunch 2017.