Get page from external server
14,704
If your fopen_wrappers are enabled, you can use file_get_contents() to retrieve the page, and then insert JavaScript into the content before echoing it as output.
$content = file_get_contents('http://example.com/page.html');
if( $content !== FALSE ) {
// add your JS into $content
echo $content;
}
This of course won't affect the original page.
Author by
joepour
Updated on June 04, 2022Comments
-
joepour almost 2 years
I want to pass a function a string, which takes that string tacks it onto url. Then goes to that url and then returns the page to my server so I can manipulate it with JS.
Any Ideas would be much appreciated.
cheers.
-
Cameron almost 15 yearsYeah, file_get_contents() is probably also easier but this will work if fopen_wrappers is not enabled.