skip to Main Content

I am working on an application which allow the customer to log into an osCommerce website to retrieve data. So far I have this script, which works fine for few other websites like WordPress, but not for osCommerce.

<?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;
?>

I don’t know where could be the problem as I don’t have enough experience in PHP to see it.
What should I modify in order to make this script log into website? Thanks in advance!

2

Answers


  1. oscommerce takes “username” and not “email_address” as long as I know – unless you change the name of FORM field. Try passing usename instead of email_address.

    Login or Signup to reply.
  2. You have to send curl to http://demo.oscommerce.com/login.php?action=process instead of http://demo.oscommerce.com/login.php to go directly to check the variables

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search