我正在研究一个允许客户登录到osCommerce网站以检索数据的应用程序。到目前为止,我已经有了这个脚本,对于像Wordpress这样的其他几个网站来说效果不错,但是对于osCommerce来说却不是。通过PHP自动登录到osCommerce,使用cURL
<?php
$ch = curl_init();
// Login here
curl_setopt($ch, CURLOPT_URL, 'http://demo.oscommerce.com/login.php');
curl_setopt ($ch, CURLOPT_POST, 1);
// Login/password
curl_setopt ($ch, CURLOPT_POSTFIELDS, '[email protected]&password=123456');
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
// Get this file
curl_setopt($ch, CURLOPT_URL, 'http://demo.oscommerce.com/account.php');
$content = curl_exec ($ch);
curl_close ($ch);
// Show the file
echo $content;
?>
我不知道哪里可能是问题,因为我没有足够的经验在PHP看到它。 我应该修改哪些内容才能使此脚本登录到网站?提前致谢!
跑了,工作。你的错误是什么? – random 2012-02-15 01:40:24
它只是给了我一个空白页面。如果我回显页面index.php,那么它会显示我的页面,但用户仍未登录。 – Cosmi 2012-02-26 19:00:30
您正在使用有效的帐户登录权限? – random 2012-02-26 21:31:49