Displaying Content from an External URL Using jQuery () Download

How to display external url inside local div element using jQuery?
The code I tried does not load even if I use php to handle cross-domain requests.

grab.php

<?php echo file_get_contents($_GET['url']); ?>

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script>
       $(function(){
        var contentURI= 'en.wikipedia.org/wiki/Film #mw-content-text';
        $('#response').load('grab.php?url='+ contentURI);
       });
   </script>
</head>
<body>
<div id="response"></div>   
</body>
</html>
+4
source share
1 answer

I suggest you use the iframe method.

Here is a simple example https://www.w3schools.com/tags/tag_iframe.asp

-1
source

Source: https://habr.com/ru/post/1691387/


All Articles