apipage/README.md

48 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2019-06-26 12:20:17 +02:00
API Page
========
2019-06-26 13:00:37 +02:00
Retrieves information as JSON from a web page using `j0k3r/graby` and `fusonic/opengraph`.
2019-06-26 12:20:17 +02:00
Installation
------------
Requirements:
* PHP 7.3
* Composer ([documentation](https://getcomposer.org/))
```
$ git clone https://gitnet.fr/deblan/apipage.git
$ cd apipage
$ composer install
$ cp .env.dist .env
```
Usage
-----
If you use Apache2 or Nginx, serve `web/` as document root and `web/index.php` as router.
To prevent security issue, fill your domain name into `.env`.
In a development environment, you can run the built in PHP web server:
```
2019-06-26 12:58:55 +02:00
$ php -S 127.0.0.1:8080 -t web web/index.php
2019-06-26 12:20:17 +02:00
```
2019-06-26 12:58:55 +02:00
Browse `http://127.0.0.1:8080/do/{parser}?url={url}` where:
* `parser` is `graby` or `opengraph`
* `url` is the page that you want to parse
### Examples
GET http://127.0.0.1:8080/do/graby?url=https://www.deblan.io/post/565/verifier-la-date-d-expiration-de-noms-de-domaine
Result is https://gist.deblan.org/en/view/5d134f8800cbd
GET http://127.0.0.1:8080/do/opengraph?url=https://www.deblan.io/post/565/verifier-la-date-d-expiration-de-noms-de-domaine
Result is https://gist.deblan.org/en/view/5d134fc6c91fa