How to peform an external request in Kohana 3?
Posted
by alex
on Stack Overflow
See other posts from Stack Overflow
or by alex
Published on 2010-04-15T03:11:45Z
Indexed on
2010/04/15
3:13 UTC
Read the original article
Hit count: 198
I've always used cURL for this sort of stuff, but this article got me thinking I could request another page easily using the Request object in Kohana 3.
$url = 'http://www.example.com';
$update = Request::factory($url);
$update->method = 'POST';
$update->post = array(
'key' => 'value'
);
$update->execute();
echo $update->response;
However I get the error
Accessing static property Request::$method as non static
From this I can assume it means that the method method is static, but that doesn't help me much. I also copied and pasted the example from that article and it threw the same error.
Basically, I'm trying to POST to a new page on an external server, and do it the Kohana way.
So, am I doing this correctly, or should I just use cURL (or file_get_contents()
with context)?
© Stack Overflow or respective owner