PHP cURL-如何判断I';我成功登录了吗?
我正在尝试确定我的登录是否成功。 所以我用我的凭证登录并点击提交 当我点击submit时,它所做的只是在post字段下面包含另一个站点 以下是我点击提交前的屏幕截图: 以下是我点击提交后的部分屏幕截图: 我尝试输入正确和不正确的凭据,但同样的情况也发生了。 我不确定我的登录是否成功。登录后,我计划在会员区发布帖子 注意:message post字段目前未被使用,我会将其用于其他用途,但以下是我的代码:PHP cURL-如何判断I';我成功登录了吗?,php,ajax,post,curl,Php,Ajax,Post,Curl,我正在尝试确定我的登录是否成功。 所以我用我的凭证登录并点击提交 当我点击submit时,它所做的只是在post字段下面包含另一个站点 以下是我点击提交前的屏幕截图: 以下是我点击提交后的部分屏幕截图: 我尝试输入正确和不正确的凭据,但同样的情况也发生了。 我不确定我的登录是否成功。登录后,我计划在会员区发布帖子 注意:message post字段目前未被使用,我会将其用于其他用途,但以下是我的代码: <html> <div> <form metho
<html>
<div>
<form method="POST">
Message: <input name="message" type="text" size="25" /></br>
Username:<input name="username" type="text" size="25" /></br>
password:<input name="password" type="password" size="25" /></br>
<input name="submit" type="submit" value="submit" />
</form>
</div>
</html>
<?php
if(isset($_POST['message'])){$message= $_POST['message'];}
if(isset($_POST['username'])){$username = $_POST['username'];}
if(isset($_POST['password'])){$password = $_POST['password'];}
if(isset($_POST['submit'])){
$link = "http://site.com/index.php?section=login;
$datatopost = array (
"auth_key" => "880ea6a14ea49e853634fbdc5015a024",
"referer" => "http://google.com",
"ips_username" => $_POST['username'],
"ips_password" => $_POST['password'],
);
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $link);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returndata = curl_exec($ch);
echo $returndata;
curl_close($ch);
};
?>
信息:
用户名:
密码:
我想登录是在服务器端。你应该从你发布到的文件中返回一些东西,不管是成功还是失败
登录后是否回显一些内容?首先手动登录该站点,并在登录后重定向的页面中找到一些徽标id或标题。然后回显这个id或标题你能再解释一下吗?我想我知道你想说什么,但不太确定。徽标始终存在,无论是否登录。我通常会这样做<代码>如果($returndata[“success”]==1){###执行某些操作、重定向或其他操作}其他{###登录失败}