1
0
Fork 0
mirror of https://github.com/Findus23/HNReader.git synced 2024-09-19 15:23:44 +02:00
HNReader/reader/reader.php

24 lines
498 B
PHP
Raw Normal View History

2021-04-08 22:29:27 +02:00
<?php
require_once "vendor/autoload.php";
use Graby\Graby;
2021-04-17 23:05:32 +02:00
$defaultUseragent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.92 Safari/535.2';
$customUseragent = "HNClient (in development)";
$userAgent = $defaultUseragent . " " . $customUseragent;
2021-04-08 22:29:27 +02:00
$url = file_get_contents("php://stdin");
2021-04-17 23:05:32 +02:00
$graby = new Graby([
"http_client" => [
'ua_browser' => $userAgent,
]
]);
2021-04-08 22:29:27 +02:00
$result = $graby->fetchContent($url);
echo json_encode($result);