-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Andresito de Guzman edited this page Jul 21, 2017
·
2 revisions
This is a library for PHP that you can use to extract important information from a webpage.
// Require the File
require("kunin.php");
// Create an object for one url
$url = "https://github.com/andresitodeguzman";
$obj = new kunin($url);
// Require file
require("kunin.php");
// Declare URL and Create Object
$url = "https://github.com/andresitodeguzman";
$obj = new kunin($url);
// Create Preset Values in case values are empty
$title = "Unknown Title";
$description = "No description provided";
// Get Title and Check if set
$t = $obj->getTitle();
if(isset($t)){
$title = t;
}
// Get Description and Check if set
$d = $obj->value("description");
if(isset($d)){
$description = $d;
}
// Prepare by creating an array
$array = array(
"title"=>"$title",
"description"=>"$description"
);
// Encode array into json and echo
echo json_encode($array);
// getTitle()
$title = $obj->getTitle();
// value(String $keyword)
$value = $obj->value("description"); // Returns description of site
Returns an array of images from the site
// getImages()
$images = $obj->getImages();