Cron job with Json decoder issue
this is my corn job : /usr/local/bin/php -q /home/malin/public_html/youtube_api_test/cron_autosave_api_data.php
this is the function i wanna run using corn job
json_decode() is not function with the corn job
function getytChannelData($channel_id,$api_key)
{
$data = file_get_contents('https://www.googleapis.com/youtube/v3/channels?part=statistics&id='.$channel_id.'&key='.$api_key);
return $out = json_decode($data, true );
}
json_decode() is not function with the corn job
-
Does the Cron job function normally when run over the command line or does it also have an issue when run there? 0 -
Does the Cron job function normally when run over the command line or does it also have an issue when run there?
Can I know how to run Cron job over command line? thing is if I call the file on browser, the function is working fine. ex:"https://test.example.net/folder_name/test.php"
like this0 -
You can run the cron over the command line interface by just using the command you run in the cron: /usr/local/bin/php -q /home/malin/public_html/youtube_api_test/cron_autosave_api_data.php0 -
/usr/local/bin/php -q /home/malin/public_html/youtube_api_test/cron_autosave_api_data.php
yeah, it's working, it will output "GET DATA API". but json_decode() is not working.0 -
If there was an error with json decode on the system I would anticipate seeing an error being output when you run this. Have you run this script successfully before? 0
Please sign in to leave a comment.
Comments
6 comments