Author Topic: Cron job error? -SOLVED  (Read 611 times)

0 Members and 1 Guest are viewing this topic.

Offline Phlerb

  • Expert Weather Dabbler
  • Member
  • *
  • Posts: 18
    • Old Pump Road Wx
Cron job error? -SOLVED
« on: January 06, 2015, 05:00:19 PM »
I am continuing on my background changing adventure, and even though if I use

www.deadcowz.com/ChangeBackground.php

Everything work and the background changes to what it should.

If I have the Cron job run this same ChangeBackground.php which has 2 includes to get the variables for weather and day or night:

Code: [Select]
<?php 
include 'wucallapi.php';

include 
'sunrise-sunset.php';

I get this error emailed to me:

<br />
<b>Fatal error</b>:  Call to undefined function: json_decode() in <b>/homepages/17/d554858752/htdocs/DEADCOWZdomainroot/wucallapi.php</b> on line <b>2</b><br />


Here is the code at the top, essentially directly from WU.

Code: [Select]
<?php $json_string file_get_contents("http://api.wunderground.com/api/3aa3d2f44c50a999/geolookup/conditions/q/VT/Jericho.json"); 
$parsed_json json_decode($json_string); 
$weather $parsed_json->{'current_observation'}->{'weather'};


Thank you for any assistance on this.
Phil
« Last Edit: January 07, 2015, 02:23:29 PM by Phlerb »

Offline Phlerb

  • Expert Weather Dabbler
  • Member
  • *
  • Posts: 18
    • Old Pump Road Wx
Re: Cron job error?
« Reply #1 on: January 06, 2015, 09:33:33 PM »
Looks like the issue was that it was defaulting to PHP 4.4.9, and needed PHP 5

Changed that with a shiny new .htaccess file, and now the cron job is no longer throwing an error!

Phil

 :grin: