Php Httprequest Generates Exception In Yii

This is strange and certainly I don’t know what’s going on.

I installed PHP HttpRequest lib, then did this test method in Yii:

When I go to localhost/logintest/index.php?r=accessTest/Bla

I get the user’s email as plain text.

But with the HttpRequest, I get an error:

The result is:

Shouldn’t it get the same answer both times?

Thanks a lot.

I’d guess your HTTP request isn’t sending the cookies required to identify the logged in user. When you navigate using your browser, the browser sends the cookie which identifies your session.

In your HTTP request, the user is essentially a guest, so doesn’t have the email attribute set.

Hmmmm seems probable… I will see if there’s a work around. Thanks!

Indeed, that was the problem. And also a problem with CURL hanging Apache because of sessions.

This simple script works and gets the Yii session and info: