On Jun 4, 2:10 pm, damezumari <jannordgr...@gmail.comwrote:
Is there a way to let the html content of an external url be input to
a php procedure?
Example: I want to show the content ofhttp://server.com/test.html,
but with every occurrence of the word 'chess' replaced by 'go'.
Kind regards,
Jan Nordgreen
function doSomething ($url)
{
if ($handle = fopen ($url, 'r'))
{
// Do something with the page
fclose ($handle);
return ('Page accessed');
}
}
Or even :
function getPage ($url)
{
return (file_get_contents ($url))
}
Do bear in mind reading web pages over the internet can be a lot
slower than reading from the filesystem. If a server takes longer than
30 seconds to respond when you try to access it then your script will
time out (assuming the default timeout value is still configured,
which it usually is).