У меня возникли проблемы с использованием cURL для определенной страницы.cURL пост не работает PHP
Живой код рабочий: http://svgen.com/jupiter.php
Вот мой код:
$url = 'https://uspdigital.usp.br/jupiterweb/autenticar';
$data = array('codpes' => 'someLogin', 'senusu' => 'somePass', 'Submit' => '1');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "FileHere");
curl_setopt($ch, CURLOPT_COOKIEFILE, "FileHere");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP);
curl_exec($ch);
curl_close($ch);
Хотя я использовал тот же URL-адрес и почтовые данные, file_get_contents работали:
$options = array('http' => array('method' => 'POST','content' => http_build_query($data)));
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
Кто-то может помочь меня? Спасибо.
Какую ошибку вы получаете? –
Вы вернетесь? – uvinod
Я не могу выполнить аутентификацию с помощью cURL –