Major PHP methods TO GET CONTENT from URL
(Note: if you want to get the images and links correctly from the target link, you may need to re-make content before output. for example, change href="./imageblabla.png" to href="http://site.com/imageblabla.png")
1) php.ini de, sizin hosting (İlk başta Allow_url_ {[(0 etkinleştirmek)]} ya da bir yerde)
<?php
//you may use "r" instead of "rb"
$variablee = fopen('http://example.com/', "rb");
echo stream_get_contents($variablee);
?>
OR
2)
<?php
$variablee = readfile("http://example.com/");
echo $variablee;
?>
OR
3) (ilk başta, etkinleştirmek php_curl, php_imap, php_openssl)
<?php
// you can add anoother curl options too
// see here - http://php.net/manual/en/function.curl-setopt.php
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_POST, TRUE); // Use POST method
//curl_setopt($ch, CURLOPT_POSTFIELDS, "var1=1&var2=2&var3=3"); // Define POST data values
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;
}
$variablee = get_data('http://example.com');
echo $variablee;
?>
OR
4)
<?php
$variablee = file_get_contents("http://example.com/");
echo $variablee;
?>
OR
5) (İlk başta Allow_url_ etkinleştirmek include)
<?php
$variablee = include "http://example.com/";
echo $variablee;
?>