Category Archives: META

Stuff about the contents of the blog

Facebook PHP SDK Tips

Hmm so I wrote this in November 2014… and didn’t publish it. Then found it again in November 2015. I don’t know why it was in draft – usually because there’s something horribly wrong with it. But… seems ok, and I haven’t played with the FB API since then so I doubt I can add anything (or even that it still applies) hence… PRESSING PUBLISH:

Over the last two days I’ve been at a startup event called SyncTheCity and been building a little startup called cotravel (website, twitter, facebook). One of the supposedly easy tasks was to integrate the Facebook SDK in PHP to allow facebook logins.

I blame lack of sleep and time pressure but actually this was a pain in the behind. However I have two tips for future sufferers:

1. Development Domain

Facebook will only accept requests from domains you have linked. In our case this means our live domain. We develop locally on our machines (127.0.0.1 or localhost) but you can’t register those as valid domains.

However what you can do is create an A record in your domain to 127.0.0.1 so you now have local.yourdomain.com pointing to 127.0.0.1. You can add local.yourdomain.com to facebooks’ domains for your app and off you go.

2. URL is required at both ends

The docs say you must pass a request_uri to redirect to when calling – but you must also pass the SAME uri on return or else death and room results.

This means that your two files (http://domain.com/sender.php and http://domain.com/recipient.php) must have code like:


session_start();
FacebookSession::setDefaultApplication('appid', 'appsecret');
$URL="http://domain.com/recipient.php";
$helper = new FacebookRedirectLoginHelper($URL);
$loginUrl = $helper->getLoginUrl($params);
header("Location: ".$loginUrl);

And recipient.php:


session_start();
FacebookSession::setDefaultApplication('appid', 'appsecret');
$URL="http://domain.com/recipient.php";
$helper = new FacebookRedirectLoginHelper($URL);
try {
$session = $helper->getSessionFromRedirect();
} catch(FacebookRequestException $ex) {
echo "Facebook Authentication Error";
} catch(\Exception $ex) {
echo "Facebook Authentication Failure";
}

Note in the above this line is the one that differs from the example:


$helper = new FacebookRedirectLoginHelper($URL);

e.g. you must pass the URL!

Purplepixie on Facebook

In amazing news Purplepixie Systems, purveyors of shoddy freeware such as FreeNATS and PHPDNS, have come fashionably late to the party and have a Facebook page!

Rejoice!

You are now free to go and like (or dislike) our page, which is also where you can chat to us for support/questions/comments on any of the Purplepixie products. This may be especially useful as forum registrations are still disabled and little progress is being made on getting it back online.

We can be found in this amazing new world of social media wonder at: https://www.facebook.com/purplepixiesystems

PHPDNS SCM on GitHub.com

PHPDNS, the Purplepixie.org open source direct DNS query API for PHP, now has its development source code hosted on github.com.

Packaged releases (and release source code versions) will continue to be distributed directly from the PHPDNS web site.

The source code management (SCM) repository for development code can be found at: https://github.com/purplepixie/phpdns

All Purplepixie projects hosted on github can be found at: https://github.com/purplepixie

Forum Enabled for New Registrations

A while back I was forced to disable registrations to the Purplepixie Support Forum thanks to a massive quantity of spam, most of which was of a very unseemly nature (very very unseemly).

Following an update to the Purplepixie Forum phpBB and enabling of reCAPTCHA I’ve now re-enabled user registration.

Apologies to anyone who’s had difficulty getting support and had to end up emailing me directly, but I hope the new changes will allow the forum to operate from now on.

 

What’s All This Then?

So here it is the Purplepixie.org official blog.

The intent of this blog is two-fold:

  1. Provide a centralised point of information for various Purplepixie products and services
  2. Act as a spleen-venting point for my ramblings on various tech and non-tech things

Since 2001 Purplepixie has built up a small selection of freeware software and free-to-use services. Naturally given the longevity of the developments this has led to a quite fragmented estate which becomes harder to maintain over time.

Projects and services on Purplepixie consist of some which are a small player in large domains (for example FreeNATS which has a few thousand users of the hundreds of thousands or even millions of network monitor users) or a larger player but in small domains (such as VSO Journals, the only VSO-specific blog aggregation service). Some of course are hardly used at all or are simply redundant today (being based upon very old versions of Linux or solving a problem which no longer exists such as ISDN).

To try and make the estate more manageable and accessible the following is therefore planned.

Source Code Management (SCM) for Everything

The intention is currently to eventually make everything currently still being developed or maintained available through github.com. This isn’t as straightforward as it sounds because most of the projects have their own convoluted build and test scripts which may contain sensitive information or be host-specific. They need to be cleansed of any sensitive information and also updated to be suitable for general source release.

The first project (and only as I write) to make full use of github was FreeDESK with the full development environment code, including unit tests, build scripts, and release packages included within the SCM.

Centralised Source of Information

This very here blog will act as a central source of information, covering updates and new releases.

Some projects, by nature of their complexity, have their own news feeds and release advertisements (FreeNATS and FreeDESK). The plan is to bring the smaller projects into this blog with the larger ones perhaps to follow at a later date.

Standard Mini-Site/Project Web Framework

All of the projects have their own little mini-websites. Most of these are built using PHP and standard templates but are individualised, which makes it hard to maintain and update.

Consideration will be given to replacing all projects with a standardised CMS-style system or, at the very least, a standard information linking mechanism (using this blog as the central point).