我在使用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和POST数据,的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);
有人可以帮助我? 谢谢。
你得到什么错误? – 2013-03-01 06:21:32
你有没有得到任何回报? – uvinod 2013-03-01 06:21:40
我无法使用cURL进行身份验证 – 2013-03-01 06:21:51