Friday, February 23, 2024
 Popular · Latest · Hot · Upcoming
79
rated 0 times [  81] [ 2]  / answers: 1 / hits: 81165  / 12 Years ago, mon, may 21, 2012, 12:00:00

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?


More From » php

 Answers
17

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.


[#85437] Sunday, May 20, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maxinec

Total Points: 117
Total Questions: 116
Total Answers: 116

Location: Bangladesh
Member since Sat, Jan 23, 2021
3 Years ago
maxinec questions
;