I am trying to create a PHP script which can request data, such as HTML content, from an external server, then do something with the received content. Here is a generalized example of what I am trying to accomplish:
//Get the HTML generated by http://api.somesite.com/
//Now tack on the Unix timestamp of when the data was received
$myFetchedData = $dataFromExternalServer . "\n Data received at: ". time();
echo $myFetchedData;
I’m thinking I should use curl in here somewhere, but I am not sure after that. Could someone post a generalized example of how I could do this?
If you only need GET and
allow_url_fopenis enabled on your server, you can simply use