0

Possible Duplicate:
PHP HTTP-Request

I want to use a PHP Core class in my Yii Application. However, Yii automatically tries to import the class name as a file.

How do I use a PHP core class in Yii WITHOUT it trying to import a file?

EDIT: (Add code)

$r = new HttpRequest('http://example.com/feed.rss', HttpRequest::METH_GET);
$r->setOptions(array('lastmodified' => filemtime('local.rss')));
$r->addQueryData(array('category' => 3));
try {
    $r->send();
    if ($r->getResponseCode() == 200) {
        file_put_contents('local.rss', $r->getResponseBody());
    }
} catch (HttpException $ex) {
    echo $ex;
}
Community
  • 1
  • 1
Abram I
  • 185
  • 2
  • 7
  • There, I edited the question to add my code. Sorry, I am new to Stack Overflow. – Abram I Oct 18 '12 at 03:24
  • If you run into an error, you should as well show the error message and better describe what happens. *"Yii automatically tries to import the class name as a file"* for example is not clear to me what it means. Might be me, but error messages are helpful, often. – hakre Oct 18 '12 at 10:15

1 Answers1

0

HttpRequest is not installed/enabled by default PHP installation. You need to install it.

Because it doesn't exists Yii tries to autoload from its known folders.

Pentium10
  • 204,586
  • 122
  • 423
  • 502