mirror of
https://github.com/bdnugget/chromecast-webpage-viewer.git
synced 2026-11-07 03:27:27 +00:00
Includes PHP proxy code.
This commit is contained in:
1 parent
0378e142e8
commit
c23a9dbcb8
1 file changed
+21
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$url = $_GET['url'];
|
||||
if (!isset($url) || empty($url)) { return; }
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
$data = curl_exec($ch);
|
||||
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
||||
curl_close($ch);
|
||||
|
||||
http_response_code($httpcode);
|
||||
|
||||
print '<base href="' . parse_url($url, PHP_URL_SCHEME) . '://' . parse_url($url, PHP_URL_HOST) . '">';
|
||||
print $data;
|
||||
Reference in new issue
Block a user