Answer the question
In order to leave comments, you need to log in
Why is cron not reading the file?
Here is the code I have. Reads the last 5 topics in the community and sends me the last message from them if it hasn't already been sent. I, like a decent Alyoshka, so as not to fool around, I just write to a file and that's it. I will give only part of the code, the rest has nothing to do with the question :)
<?php
...
for($i = 1; $i <= 5; $i++) {
$offset = $topics['response']['topics'][$i]['comments'] - 1;
$is1 = "https://api.vk.com/method/board.getComments?access_token=".$token."&group_id=GID&topic_id=".$topics['response']['topics'][$i]['tid']."&offset=".$offset."&count=1";
$topics1 = json_decode(file_get_contents($is1),true);
echo $topics1['response']['comments'][1]['date']."\r\n";
$t = $topics['response']['topics'][$i]['tid'];
echo file_get_contents("vk/".$t.".txt");
if($topics1['response']['comments'][1]['date'] != file_get_contents("vk/".$topics['response']['topics'][$i]['tid'].".txt")) {
file_put_contents("vk/".$topics['response']['topics'][$i]['tid'].".txt",$topics1['response']['comments'][1]['date']);
...
?>
1422817926
Warning: file_get_contents(vk/31014373.txt): failed to open stream: No such file or directory in /home/u850898830/public_html/board.php on line 15
Answer the question
In order to leave comments, you need to log in
The point, most likely, is that '/home/u850898830/'
add the working folder for cron to the beginning of the script:chdir('/home/u850898830/public_html/');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question