【发布时间】:2014-12-15 21:23:54
【问题描述】:
我正在使用 Kohana 3.3 并尝试向我们公司内部的 url 发出外部请求。外部网站需要用户凭据。我如何向该网站发出外部请求?我打算使用单个请求登录,然后点击我想要的 URL,但我该如何实现呢?示例代码如下。
Request::factory('http://example.com/user/login')->method('POST')->post('username', 'abc')->post('password', '123')->execute();
$request = Request::$current;
$request->factory('http://example.com/do/this')->method('POST')->post('param1', 'value')->post('param2', 'value2');
$response = $request->execute();
上面的代码在$request->factory() 失败,说它不是一个对象,不能调用 factory() 方法。
谁能告诉我在 Kohana 3.3 中尝试实现的正确方法是什么?
【问题讨论】:
标签: authentication login request external kohana