【发布时间】:2011-06-15 04:14:48
【问题描述】:
我有一些卷发问题,我不知道如何解决。
这个想法是获取用户的用户名和密码并将其发布到外部网页。
代码如下:
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://sso.uc.cl/cas/login?service=https://portaluc.puc.cl/uPortal/Login"); // URL to post
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "username=$usuario&password=$pw");
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec( $ch ); // runs the post
curl_close($ch);
echo "Reply Response: " . $result; // echo reply response
这是错误:
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /home/th000862/public_html/encuesta/login2.php on line 10
出现该错误后,用户未登录到外部网页。
【问题讨论】:
-
如果 curl 变通方法不起作用,请尝试 PEAR Http_Request2 或 Zend/Horde 或其他 HTTP 实用程序实现。