ok... im stuck here and dont quite understand why i cant figure that out myself... let me explain... im having a script that allows people to implement a newsfeed on their site. the news come forom a file that is located on my own (for them a remote) server (http://www.xxx.com/updates/index.php). Below you see the function which the user needs to grab the data - it all works fine so far.
//get the news feed
function getUpdates() {
$baseUrl = "http://www.xxx.com/updates/";
$url = parse_url($baseUrl);
if ($filePointer = @fsockopen($url['host'], 80, $errno, $errstr, 5)) {
@fputs ($filePointer, "GET " . $baseUrl . " HTTP/1.0\r\nHost: " . $url['host'] . "\r\n\r\n");
while (!feof($filePointer)) {
$line = @fgets ($filePointer,4096);
$output .= $line;
}
}
//HERE I WOULD LIKE TO APPEND THE TIMESTAMP TO "112003.log";
if ($output) {
return $output;
}
else {
return "No news available";
}
}
now - what i would like to do now is the following:
whenever somebody downloads the news, i'd like to log the timestamp in a seperate file (MMYYYY.log) on my server. i.e. id like to have the function not just read the data, but also append a new line to a file (and create it in case if it does not exist - it should b named by month and year - i.e. 200311.log) with the timestamp.
so what i want is something like
fputs ($filePointer, "GET " . $baseUrl . date("Ym") . ".log HTTP/1.0\r\nHost: " . $url['host'] . "\r\n\r\n");
fwrite ($filePointer, time() . "\n", "a");
since all that takes place on a remote (my) server im kinda stumped and would love to receive some assistance..
thanks guys...