new bingcache(); class bingcache{ public function __construct(){ if( !isset($_GET["s"]) || $this->validate_url($_GET["s"]) === false ){ var_dump($this->validate_url($_GET["s"])); $this->do404("Please provide a valid URL."); } $url = $_GET["s"]; $curlproc = curl_init(); curl_setopt( $curlproc, CURLOPT_URL, "https://www.bing.com/search?q=url%3A" . urlencode($url) ); curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding curl_setopt( $curlproc, CURLOPT_HTTPHEADER, ["User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", "Accept-Language: en-US,en;q=0.5", "Accept-Encoding: gzip", "DNT: 1", "Connection: keep-alive", "Upgrade-Insecure-Requests: 1", "Sec-Fetch-Dest: document", "Sec-Fetch-Mode: navigate", "Sec-Fetch-Site: none", "Sec-Fetch-User: ?1"] ); curl_setopt($curlproc, CURLOPT_RETURNTRANSFER, true); curl_setopt($curlproc, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($curlproc, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($curlproc, CURLOPT_CONNECTTIMEOUT, 5); $data = curl_exec($curlproc); if(curl_errno($curlproc)){ $this->do404("Failed to connect to bing servers. Please try again later."); } curl_close($curlproc); preg_match( '/