Hi,
I'm trying to set up a cron job that runs every so often and updates the FBML that gets fed to the profile of users of my application. Below is the basics (the full thing I want to do would update the refs for each user's page, but if I can get this working I can do that hopefully!):
The command I've entered into cron jobs is:
php-cron /home/{my folder}/public_html/cron_job.php
If I just visit the page, it updates correctly, but if ran as a cron job, nothing happens.
The email I get confirming it says this:
Which if you follow goes to an error saying page is unavailable.
Does anyone have any suggestions where I'm going wrong? Any help is greatly appreciated!
I'm trying to set up a cron job that runs every so often and updates the FBML that gets fed to the profile of users of my application. Below is the basics (the full thing I want to do would update the refs for each user's page, but if I can get this working I can do that hopefully!):
Code:
[B]<?php
[I]// Include the facebook library config files.[/I]
[U]include_once[/U] 'facebook.php';
$appapikey = 'my key';
$appsecret = 'my secret';
$facebook = [U]new[/U] Facebook($appapikey, $appsecret);
[I]// infinite session key[/I]
$myInfinite = 'my infinite';
$facebook->api_client->session_key = $myInfinite;
[I]// generate headline to push[/I]
$headline = "[B]<h2>[/B] ". randomheadline() . "[B]</h2>[/B][B]<br>[/B]";
[B][U]try[/U] {
[I]// Set Profile FBML[/I]
[/B] [U]include[/U] 'default_fbml.php';
$facebook->api_client->fbml_setRefHandle(global_announcement, $headline);
$facebook->api_client->fbml_refreshRefUrl("httpL/stuff.../default_fbml?handle=global_announcement");
$facebook->api_client->profile_setFBML($fbml,$user);
} [U]catch[/U] (Exception $e)
{$msg = $e->getMessage();
[U]echo[/U] "Exception: $msg\n";
}
?>[/B]
The command I've entered into cron jobs is:
php-cron /home/{my folder}/public_html/cron_job.php
If I just visit the page, it updates correctly, but if ran as a cron job, nothing happens.
The email I get confirming it says this:
Code:
[COLOR=#550055]<script type="text/javascript">
top.location.href = "[/COLOR][URL="http://www.facebook.com/login.php?v=1.0&api_key={my key}&next=http%3A%2F%2F"][U][COLOR=#0000ff]http://www.facebook.com/login.php?v=1.0&api_key={my key}&next=http%3A%2F%2F[/COLOR][/U][/URL][COLOR=#550055]";
</script>[/COLOR]
Does anyone have any suggestions where I'm going wrong? Any help is greatly appreciated!