Yii and Instagram Real time api subscription

156 views Asked by At

I am trying to add a subscription with the Instagram Real-time API setting the callback_url to a Yii (1.1.16) driven page and everytime the API calls to that page it gets an server error (500). On the apache log I get this:

173.252.114.111 - - [14/Jun/2015:10:09:35 +0000] "GET /site/instagram?hub.verify_token=mytoken&hub.challenge=XXX&hub.mode=subscribe HTTP/1.1" 500 341 "-" "Python-httplib2/0.8 (gzip)"

When I change the callback_url to a php page without Yii (www.mydomain.com/instagram.php) it works without problems.

173.252.114.111 - - [14/Jun/2015:09:53:08 +0000] "GET /instagram.php?hub.verify_token=mytoken&hub.challenge=XXX&hub.mode=subscribe HTTP/1.1" 200 200 "-" "Python-httplib2/0.8 (gzip)"

The code I use in the controller:

public function actionInstagram()
{
    $this->layout = false;
    echo $_GET["hub_challenge"];
    Yii::app()->end();
}

Does anyone know why Yii is giving this error?

1

There are 1 answers

0
nilsburg On

Ok, I found out what is happening. It seems that the Instagram RealTime API uses python httplib2 and it is not sending some request headers like HTTP_ACCEPT_LANGUAGE and I had a extensions that was trying to get $_SERVER['HTTP_ACCEPT_LANGUAGE'] thus php was giving an undefined index error.

My bad!