curl重定向登录凭据保护

curl重定向登录凭据保护,curl,password-protection,Curl,Password Protection,我正在考虑在一个网站上使用curl来登录我拥有的不同网站,所以我在网上找到了一些示例代码。现在我的问题是:以这种方式提供用户名和密码是否节省。否则,我该怎么办 $url_post = "http://localhost/joomla/joomlathree/index.php?option=com_users&task=user.login&lang=en"; $postdata = "username=".urlencode($uname)."&password=".u

我正在考虑在一个网站上使用curl来登录我拥有的不同网站,所以我在网上找到了一些示例代码。现在我的问题是:以这种方式提供用户名和密码是否节省。否则,我该怎么办

$url_post = "http://localhost/joomla/joomlathree/index.php?option=com_users&task=user.login&lang=en";
$postdata = "username=".urlencode($uname)."&password=".urlencode($upswd)."&return=".urlencode($matches1[1][0])."&".urlencode($matches2[1][0])."=1";
curl_setopt($ch, CURLOPT_URL, $url_post);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$results1 = curl_exec($ch);

$url_data = "http://localhost/joomla/joomlathree/index.php?option=com_users&lang=en"; //MOD REWRITE Disabled
curl_setopt($ch, CURLOPT_URL, $url_data);

$results2 = curl_exec($ch);
$error = curl_error($ch);
$errno = curl_errno($ch);
echo ($error);

curl_close($ch);

卷曲操作使用安全。但是,您应该使用https发送凭据,因为如果没有https,其他人可以很容易地从请求中读取凭据。

这实际上是一条评论,而不是答案。再重复一点。