Here are two different, easy ways to get content from a URL :
1) first method
Include Allow_url_include from your hosting (php.ini or somewhere else)
<?php $variableee = readfile("http://example.com/"); echo $variableee; ?>
or
2) second method
Enable php_curl, php_imap and php_openssl
<?php // you can add anoother curl options too // see here - http://php.net/manual/en/function.curl-setopt.php function get_dataa($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data = curl_exec($ch); curl_close($ch); return $data; } $variableee = get_dataa('http://example.com'); echo $variableee; ?>
T.Todua Apr 03 '13 at 13:36
source share