I want to enter OpenCart CMS with a twist automatically and add automatic to it too, but I canโt enter it. I searched and found some result, but could not help, and I do not get any result. This is my code:
<?php include_once "simple_html_dom.php"; $username = 'active'; $password = '123active'; $loginUrl = 'http://localhost:100/mywebsite/admin/'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $loginUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password); curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $store = curl_exec($ch); $html=new simple_html_dom(); $html->load($store); foreach($html->find("li#dashboard") as $dash){ echo $dash->innertext; } ?>
In this code, first I initialize username and password and my URL to bind to the administrator of my site, then I use the CURLOPT_POST request and CURLOPT_POSTFIELDS
and then execute $ch but now I have no result on cookie.txt and there was no login on the admin site.
source share