Hi i have been trying to do data scraping of all orders from order_id=1 to order_id=10 in opencart with this code
<?php
$url = 'http://www.myopencartstore.com/admin/index.php?route=sale/order/info&token=97d9e2f96bb321a6f3506834d6f082e7&order_id=1';
$content = file_get_contents($url);
$first_step = explode( '<div class="llst-item-address">' , $content );
$second_step = explode("</div>" , $first_step[0] );
print_r ($second_step);
?>
but it seens that opencart admin just automatically loggs me out and i also tried
https://import.io/ a web scrapping tool
it works for all websites with query string but when i use it with OPENCART ADMIN it just loggs me out i know you can do this with the database but the store owner told me to do it like this can you help
You could just query Opencart's database (place this php file in the root of your store, where the config.php is - it's just required for the database connection details, so you don't have to enter the details manually):
require("config.php");
$db = new MySQLi(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$result = $db->query("SELECT * FROM " . DB_PREFIX . "order WHERE order_id BETWEEN 1 AND 10");
echo "<pre>";
while ($row = $result->fetch_assoc()) {
print_r($row);
}
echo "</pre>";
$result->free();
$db->close();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.