<?php
$url = "https://geekflare.com/api/geekflare-api/screenshot";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
//curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"authority: geekflare.com",
"accept: application/json, text/plain, */*",
"accept-language: es-ES,es-US;q=0.9,es-AR;q=0.8,es;q=0.7,en-US;q=0.6,en;q=0.5",
"content-type: application/json",
"cookie: _ga=GA1.2.1489152377.1649766574; _gid=GA1.2.1915494195.1649766574; aawp-geotargeting=AR; __cf_bm=n49YrAbUKSvH2nL3pbLcar1tzFLt3zWnODIG3qNyN64-1649769787-0-AWoSbROhZ+8XjIcpd7to/QXiyuMHbMVDJVURtipOALnHQQgrML07V5BTYhmbxlUVLVP2pafABtzYa/+UPymGdaiQ4C8XsVmnE2R3BKBfYcEroEFzCZB4Txnmd8n/m/+3mw==; _gat_gtag_UA_58443135_1=1",
"origin: https://geekflare.com",
"referer: https://geekflare.com/api",
'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"',
"sec-ch-ua-mobile: ?0",
'sec-ch-ua-platform: "Windows"',
"sec-fetch-dest: empty",
"sec-fetch-mode: cors",
"sec-fetch-site: same-origin",
"user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = '{"url":"https://www.google.com/"}';
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
$con = utf8_encode($resp);
$datos = json_decode($con, true);
$screen = $datos['data']['0']['screenshot'];
echo $screen;
?>