使用php curl在https网站中填写表单登录
嘿,尝试填写这个页面的登录表单来访问这个代码,但没有工作,我停留在404错误的登录页面上,如果有人知道使用php curl在https网站中填写表单登录,php,forms,ssl,curl,https,Php,Forms,Ssl,Curl,Https,嘿,尝试填写这个页面的登录表单来访问这个代码,但没有工作,我停留在404错误的登录页面上,如果有人知道 <?php $url = 'https://nomade.pericles.fr/#/accueil'; $timeout = 10; $agent = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36"
<?php
$url = 'https://nomade.pericles.fr/#/accueil';
$timeout = 10;
$agent = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36";
$cookie_file_path = "/tmp/cookies.txt";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
if (preg_match('`^https://`i', $url))
{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Utilisation de la méthode POST
curl_setopt($ch, CURLOPT_POST, true);
// Définition des champs et valeurs à envoyer
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'user_id' => '********',
'user_pwd' => '********'
));
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$page_content = curl_exec($ch);
curl_close($ch);
echo $page_content;
?>
编辑您的帖子请接受编辑或更改自己:谢谢!对我的问题有什么帮助吗??