Jump to content

frankieM

New Members
  • Posts

    1
  • Joined

  • Last visited

frankieM's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I am having this same issue. Did you manage to make any progress? I am using the following to scrape the Joomla login form and resubmit with the token. But I do not think the cookie is working properly as the print_r at the end just gives me thisArray ( [0] => ) Any thoughts about what else to check? My browser has cookies enabled. <?php $uname = $_POST['username']; $upswd = $_POST['password']; $url = "http://www.myJoomlaS...ser&view=login"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE ); curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE ); curl_setopt($ch, CURLOPT_COOKIEJAR, realpath('./cookie.txt')); curl_setopt($ch, CURLOPT_COOKIEFILE, realpath('./cookie.txt')); curl_setopt($ch, CURLOPT_HEADER, TRUE ); $ret = curl_exec($ch); if (!preg_match('/name="([a-zA-z0-9]{32})"/', $ret, $spoof)) { preg_match("/name='([a-zA-z0-9]{32})'/", $ret, $spoof); } // POST fields $postfields = array(); $postfields['username'] = urlencode($uname); $postfields['passwd'] = urlencode($upswd); $postfields['option'] = 'com_user'; $postfields['task'] = 'login'; $postfields[$spoof[1]] = '1'; curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); $ret = curl_exec($ch); // Get logged in cookie and pass it to the browser preg_match('/^Set-Cookie: (.*?);/m', $ret, $m); $cookie=explode('=',$m[1]); setcookie($cookie[0], $cookie[1]); print_r($cookie);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.