Services_JSON for facebook app

Do you have questions regarding Pecl or Pear? ask here!

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Sat Aug 06, 2011 9:04 am

Services_JSON for facebook app

Postby glardon » Sat Aug 06, 2011 9:24 am


I have started my first facebook app / tab. Since the version of PHP on my shared hosting is still 5.1 i cannot use the the built-in json_decode function that is available from v5.2.

Therefor I downloaded the Services_JSON files from PEAR that can be included stand-alone. Howver I cannot get the json_decode to work which is needed to decode the payload data that is send by facebook to my app.

If I use my code on a server with PHP v5.3 my code works.

Anyone any idea?

This is an example payload I receive from facebook and need to decode:

Code: Select all


This is the code snippet that I isolated that causes the problem:

Code: Select all

$payload = base64_decode(strtr($payload, '-_', '+/'));
$data = json_decode($payload, true);

My script always seems to stop running at the second line. As i checked, the json_decode function exists.

Many tnx

Return to “PEAR and PECL”

Who is online

Users browsing this forum: No registered users and 1 guest