【发布时间】:2013-09-03 12:42:05
【问题描述】:
我在 CI 中构建了一个应用程序。在这里,我需要来自第三方网站/URL 的 API 代码。我不知道如何将该代码接收到我的控制器中。
$user_email = "jondoe@appsapi.com.au"
Example - https://www.sample.com.au/api/apps/auth{$user_email}
当我将这个示例域输入浏览器时,它会提供一个 API 密钥。喜欢 - A9D5w9pL 我如何将它放入我的控制器中。
控制器 -
public function auth_with_api() {
//https://www.sample.com.au/api/apps/auth{$user_email}
// here I require the API key. How can I receive it here.
}
【问题讨论】:
-
你可以使用 cUrl 请求,或者如果可以的话,使用 file_get_contents()
-
玩转ci rest客户端github.com/philsturgeon/codeigniter-restclient看看这个tut:net.tutsplus.com/tutorials/php/…
标签: php api codeigniter controller key