I want load a domain url in div element
I have 2 problems :
- if load a domain for example ‘google.com’ with http protocol don’t load address images correctly, but load page !
- if load a google map with https protocol give warning and don’t work never !
Here is my code :
load.php
<html>
<head>
<title></title>
<script type="text/javascript" src='jquery.js'></script>
</head>
<body>
<div></div>
<script type="text/javascript">
$(function(){
$('div').load('/x-request.php?url=googleMapAdress');
});
</script>
</body>
</html>
x-request.php
<?php
echo file_get_contents('https://' . $_GET['url']);
?>
Note: I don’t want to use iframe tag & my code must have ajax code!
What is the solution?
//more explain
How get any external page and load it in div element completely ?
this is means => href, src and all links work truly.
I have tried you below code and its working as expected.
php code
Its loading Google map without any error.
Edit
In response of comment following are the possible best solutions.
The setting you are looking for is
allow_url_fopen.set
allow_url_fopen = Onin php.ini file.You have two ways of getting around it without changing php.ini, one of them is to use fsockopen, and the other is to use cURL.
curl example
Quick reference links are as below for curl.
http://www.kanersan.com/blog.php?blogId=45
http://www.tomjepson.co.uk/enabling-curl-in-php-php-ini-wamp-xamp-ubuntu/