I'm trying to access my complement handler with Curl from a cron in ubuntu 14.04.
I read the forums:
but the response I get is, an access denied by cross-site attack T.T
Code:
$parameters= array('return_url' => 'admin.php', 'user_login' => 'user@test.com', 'password' => '123', 'dispatch[auth.login]' => 'Sign in');
$cookie='/cookie.txt';
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
$username = 'admin@test.com';
$password = '123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
//curl_setopt($ch, CURLOPT_REFERER, $referrer);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$parameters);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEJAR,$cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
/* curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'method' => 'POST',
"Authorization: Basic ".base64_encode("$username:$password"),
)); */
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL,$referrer);
curl_exec($ch);
curl_close($ch);
Thank you for your attention and help.