Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function fetchUrl($url) {
- $allowUrlFopen = preg_match('/1|yes|on|true/i', ini_get('allow_url_fopen'));
- if ($allowUrlFopen) {
- return file_get_contents($url);
- } elseif (function_exists('curl_init')) {
- $c = curl_init($url);
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
- $contents = curl_exec($c);
- curl_close($c);
- if (is_string($contents)) {
- return $contents;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement