Catarina Vitorino Architect Portfolio

Catarina Vitorino

Date: 2014

Technologies: WordPress, PHP5, CSS3, HTML5, Javascript

Details: Catarina Vitorino is a promising architect who wanted an online portfolio.


Receive an email from Google App engine, in php

There is not so much documentation on how to receive an email on Google App Engine (gae) with PHP. The official documentation is not really explicit, I guess it is because it is still experimental as I write.

After fighting some time, here is how to do it.

configure app.yaml with the following:

- url: /_ah/mail/.+
script: handle_incoming_email.php
login: admin

- mail

Here, I redirect every received email to handle_incoming_email.php.

In handle_incoming_email.php, the content of the received email is available not in $_POST, but in file_get_contents('php://input')

With the help of Plancake email parser, it becomes easy to get the content:

$emailParser = new PlancakeEmailParser(file_get_contents('php://input'));
$email_body = $emailParser->getBody();

Et voila.

Codebird without cURL

Google Apps Engine doesn’t allow cURL, among lots of other things, like PHP native mail(), we will come back on this another day.

I needed to post a tweet from Google Apps Engine and couldn’t find a library using URL Fetch to do so, in few lines. It seems that everybody is using cURL!

So, I took an existing project: Codebird, a nice PHP class enabling to connect to Twitter API really easily, and added the methods to make file_get_contents() requests, with SSL, instead of using cURL.

Here it is:

Git repository:



\Codebird\Codebird::setConsumerKey(your_key, your_secret);
$cb = \Codebird\Codebird::getInstance();
$cb->setToken(your_token, your_token_secret);
$params = array(
 'status' => $message
$reply = $cb->statuses_update($params);