Archive for the ‘PHP’ Category

Facebook iPhone Session Proxy in PHP (FBSession getSessionProxy)

September 3rd, 2009

If your iPhone app incorporates the Facebook Connect for iPhone library, one of the first things you will do is instantiate an FBSession object. Developers are given two choices for this according to the wiki:

session = [FBSession sessionForApplication:myApiKey secret:myAppSecret delegate:self];


session = [FBSession sessionForApplication:myApiKey getSessionProxy:myURL delegate:self];

The first option is quick to implement, and an OK option for initial testing. However, it is inherently insecure as it requires you to release your Facebook application’s secret key embedded in your code.

Unfortunately, implementing the second option isn’t straightforward. Read the rest of this entry »

Yahoo! Pipes, PHP, and web services

September 1st, 2007

I’ve finally taken the time to play around with Yahoo Pipes. I’ll probably do a few posts over the next couple of days on my findings, but I’ll get started with the basics on how to write a json web service in PHP that can be called from Pipes. The capability to call a web service from Pipes is a recently added addition by Yahoo that could prove to be very powerful.

There’s a good post and recipe for getting started over at echoditto labs. Unfortunately, my web host had two things that made this recipe a non-starter. First, they don’t allow compiling C++ extensions for PHP, as is required by the JSON PECL package. Second, they have PHP’s annoying little magic_quotes_gpc setting turned on.

Here’s a little recipe that may help you get started. You’ll need to first download the Services_JSON library — a proposed addition to PEAR that encodes and decodes JSON. The recipe below assumes that you use items as the input for the “Path to item list” prompt in Pipes. The recipe is simple and straightforward. It is the moral equivalent of Yahoo’s Java example — it simply appends ” (This text was added by the external Web Service)” to the title of each item in the feed. It provides one additional bit of functionality that may help you get started. It logs the decoded input value to pipes-log.txt. This will help give you an idea of what your input is.

Read the rest of this entry »