PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Muhammad Umer Farooq   PHP Screenshot URL Handler   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Screenshot URL Handler
Manipulate URLs and capture a screenshot of a page
Author: By
Last change:
Date: 5 years ago
Size: 1,311 bytes
 

Contents

Class file image Download
<?php

   
//call the class using require_once //better for error checking

   
require_once 'classes/Url.php';

    if (isset(
$_POST['submit'])) {
       
$test = $_POST['url'];

       
$getSite = new URL();

       
//for performance improvement
       
$getSite->SetConnTime(8);

       
$filter_url = $getSite->FilterUrl($test);

       
$getSite->SetUrl($filter_url[0][0]);

       
$data = $getSite->GetData();

       
//getting all data into array

        //print_r($data);

       
echo $data['title'];

        echo
'<br>';

        echo
$data['url'];

        echo
'<br>';

        echo
$data['slug'];

        echo
'<br>';

       
//keywords

       
echo $data['keywords'];

        echo
'<br>';

       
//description

        //echo $data['description'];
       
print_r($data['description']);
        echo
'<br>';

       
//echo $data['screenshot'];

        //printing the screenshort
       
echo '<img src="data:image/png;base64,'.$data['screenshot'].'" alt="Red dot" />';

        echo
'<br>';

       
//image if you want print all images using foreach loop

       
if (isset($data['images'][0][1])) {
            echo
$data['images'][0][1].'/>';
        }
    }

?>

<form action='' method='post'>
    <input type="text" name="url">
    <br/>
    <input type="submit" name="submit">
</form>