scrap() public method

include the Zebra_cURL library require 'path/to/Zebra_cURL'; instantiate the class $curl = new Zebra_cURL(); get page's content only $content = $curl->get('https://www.somewebsite.com/', true); print that to screen echo $content; get everything we can about the page $content = $curl->get('https://www.somewebsite.com/'); print that to screen print_r('
');
print_r($content);
        
public scrap ( string $url, boolean $body_only = false ) : mixed
$url string An URL to fetch @param boolean $body_only (Optional) When set to TRUE, will instruct the method to return only the page's content, without info, headers, responses, etc. When set to FALSE, will instruct the method to return everything it can about the scrapped page, as an object with properties as described for the $callback argument of the {@link get} method. Default is FALSE. @since 1.3.3 @return mixed Returns the scrapped page's content, when $body_only is set to TRUE, or an object with properties as described for the $callback argument of the {@link get} method.
$body_only boolean
return mixed
Esempio n. 1
0
<?php

// include the library
require '../Zebra_cURL.php';
// instantiate the Zebra_cURL class
$curl = new Zebra_cURL();
// cache results 3600 seconds
$curl->cache('cache', 3600);
// a simple way of scrapping a page
// (you can do more with the "get" method and callback functions)
echo $curl->scrap('https://google.com', true);