Skip to content

Instantly share code, notes, and snippets.

@jpsirois
Created June 1, 2012 15:36
Show Gist options
  • Save jpsirois/2853007 to your computer and use it in GitHub Desktop.
Save jpsirois/2853007 to your computer and use it in GitHub Desktop.
Render any URL as Text/HTML (proof of concept)
<?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, htmlspecialchars($_GET['URL']));
curl_exec($ch);
curl_close($ch);
?>
@xeoncross
Copy link

<?php
function getURL($url)
{
    if($url = filter_var($url, FILTER_VALIDATE_URL))
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, false);

        $result = curl_exec($ch);
        curl_close($ch);

        return $result;
    }
}

Then to use it:

print getURL($_GET['URL']);

@jpsirois
Copy link
Author

jpsirois commented Jun 4, 2012

Thanks for the suggestion I’ll look into it to update it! It’s was only a proof of concept!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment