在web/mobile中调用远程restful api时如何保护用户名密码?
这是我的php脚本,用来调用远程restful api,用户名和密码是用源代码硬编码的在web/mobile中调用远程restful api时如何保护用户名密码?,rest,restkit,Rest,Restkit,这是我的php脚本,用来调用远程restful api,用户名和密码是用源代码硬编码的 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://localhost/m1/m1apiserver/public/api/login"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "email=elson%40bla.com&a
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://localhost/m1/m1apiserver/public/api/login");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"email=elson%40bla.com&password=bla");
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec ($ch);
curl_close ($ch);
$j = json_decode($json);
// further processing ....
if ($j->token) {
//echo $j->token;
$output = file_get_contents("http://localhost/m1/m1apiserver/public/api/product?token=".$j->token);
echo $output;
}
但是有什么技术可以保护用户名密码吗?请定义“安全”。这是一个沟通问题吗?是否存在存储问题?请定义“安全”。这是一个沟通问题吗?这是存储问题吗?