ludovicm67 / url-explorer
Get all informations you need from an URL
v1.0.5
2018-08-13 09:23 UTC
Requires
- php: ^7.1
- ludovicm67/request: ^1.0
README
Get all informations you need from an URL
Installation
Just run the following command : composer require ludovicm67/url-explorer
to add it to your PHP project!
How to use it?
Running the following code :
<?php require('./vendor/autoload.php'); // include here composer autoloader! use ludovicm67\Url\Explorer\Explorer; echo new Explorer("https://github.com/ludovicm67/php-url-explorer");
will give you something like :
{ "code": 200, "title": "ludovicm67/php-url-explorer", "description": "php-url-explorer - Get all informations you need from an URL", "img": { "url": "https://avatars3.githubusercontent.com/u/9420561?v=3&s=400", "width": 250, "height": 250, "mime": "image/png" }, "type": "small", "url": { "request": "https://github.com/ludovicm67/php-url-explorer", "final": "https://github.com/ludovicm67/php-url-explorer", "base": "github.com" }, "updated": "2017-06-05T20:11:27+00:00" }
What can I get for informations?
You can get by default all the following informations from a URL:
code
: the HTTP code from the requesttitle
: the title of the pagedescription
: the webpage descriptionimg
: an image representing the webpage; if equalsnull
, no image available, else it will give you :url
: the url of the imagewidth
: the width of the imageheight
: the height of the imagemime
: the mime type of the image
type
: the type of card to display. It can have the following values :image
: the URL is an imagenone
: no information foundbasic
: only a title and maybe a description was found (no image)small
: an image was found, but it's smalllarge
: if the image has a width >= 400 and height >= 200
url
: here are some useful URL:request
: the URL used for the requestfinal
: the final URL, after some redirectionsbase
: the hostname of the final URL
updated
: the time at the UTC timezone when the informations were fetched (can be useful if you cache the results somewhere)