views:

41

answers:

1

I'm using the new facebook graph API and getting an odd error when I push to a web server.

My Code is pretty simple with fbmain.php calling facebook.php

<?php
include_once "fbmain.php";


$ab = $facebook->api('/cocacola/feed');
 echo ($ab['data']['0']['message']);

When I run this locally, it works great without any errors.

When I run it on my server, I get the error:

Parse error: parse error, unexpected '{' in /home/content/w/e/s/wesbos/html/clients/audiobooks/wp-content/themes/ab/fb/fbmain.php  on line 6

The part of fbmain.php its saying is causing the problem is :

    try{
    include_once "facebook.php";
}

Any idea why this wouldn't work on my server?

A: 

Turned out I was running PHP 4.x and try{} was only introduced in php5. Problem solved.

Wes

related questions