PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Dave Smith   PHP Scrape Stack   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Usage
Class: PHP Scrape Stack
Scrape web sites using scrapeStack API
Author: By
Last change:
Date: 4 years ago
Size: 957 bytes
 

Contents

Class file image Download
<?php
/*
example usage
weatherStack ver 1.0

You must get an API key from https://weatherstack.com/product
and enter it in the weatherstack.class.php file
*/

//turning off low level notices
error_reporting(E_ALL ^ E_NOTICE);

//instantiate the class
include('scrapestack.class.php');
$scrape = new scrapeStack();

//set the url parameter for the website to be scraped
$scrape->setParam('url','http://www.ampapps.com');

//get the response
$scrape->getResponse();

//output the response
//if json is returned we had a problem
if( $scrape->jsonReturned ){
    echo
'<pre>';
   
var_dump($scrape->response);
    echo
'</pre>';
}else{
    echo
str_replace('<','&lt;',$scrape->response);
}

/*
Premium plans are available that allow advanced features like...
using SSL to get response
rendering javascript
proxy locations
premium addressed proxies
You can see what is available at https://scrapestack.com/product.
*/
?>