Is there a JavaScript way to do file_get_contents()?
javascript, php
Solution
you could do
JS code:
$.post('phppage.php', { url: url }, function(data) {
document.getElementById('somediv').innerHTML = data;
});
PHP code:
$url = $_POST['url'];
echo file_get_contents($url);
That would get you the contents of the url.
Problem
Here is the PHP documentation Here is how I would use it in an Ajax call, if I don't find a pure client way to do this. ``` $homepage = file_get_contents('http://www.example.com/'); echo $homepage; ``` Is there way to do this client side instead so I don't have to ajax the string over?