Php 卷发贴不好用
我有个小问题 这是我的旋度函数:Php 卷发贴不好用,php,post,curl,Php,Post,Curl,我有个小问题 这是我的旋度函数: function file_get_contents_curl($url) { $ch = curl_init($url); if (isset($_SESSION['user']) && isset($_SESSION['password'])) { $log = array( 'login' => $_SESSION['user'], 'password' => $_SESSION['passwo
function file_get_contents_curl($url) {
$ch = curl_init($url);
if (isset($_SESSION['user']) && isset($_SESSION['password']))
{
$log = array(
'login' => $_SESSION['user'],
'password' => $_SESSION['password'],
'remind' => 'on'
);
curl_setopt($ch, CURLOPT_POST, count($log));
curl_setopt($ch, CURLOPT_POSTFIELDS, $log);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.pt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.pt");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close($ch);
return $data;}
但是$data的结果是原始的$url(日志页面),为什么我不能用我在$log中传递的信息登录呢
已正确键入POST表单目标。我不明白
有关信息,$url是我学校的内部网,我需要$data(loggued ofc)来预存一些信息
$url的形式是基本的:
<form method="post" action="">
<fieldset>
<legend>Connexion</legend>
<div class="login input">
<label for="auth-input-login">Login</label>
<input type="text" id="auth-input-login" name="login" placeholder="Login" />
</div>
<div class="password input">
<label for="auth-input-password">Mot de passe</label>
<input id="auth-input-password" name="password" placeholder="Mot de passe" type="password" />
</div>
<div class="remind input">
<input id="auth-input-remind" name="remind" type="checkbox" />
<label for="auth-input-remind">Se souvenir de moi</label>
</div>
</fieldset>
<div class="submit">
<input type="submit" value="Se connecter" />
</div>
</form>
连接
登录
路况
德莫伊Se纪念品
发布结果:
您知道该页面上如何处理post请求吗?也许他们会在帖子中添加随机会话?我编辑了我的帖子,他们怎么能添加随机会话?我不明白有时候页面会添加隐藏值(通常是随机数字/字母),并随POST请求一起发送。无论如何,如果没有seing内容,很难猜测代码的PHP部分是什么样子的。你有权访问那个PHP文件吗?好的,我知道了,但问题不在这里,我想这篇文章没有提交,因为我有原始页面。在使用curl发送之前,不应该将$log(post参数)转换为字符串吗?至少到目前为止我是这么用的。比如像