简体   繁体   English

Opencart 管理数据抓取

[英]Opencart Admin Data Scraping

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嗨,我一直在尝试使用此代码在 opencart 中对从 order_id=1 到 order_id=10 的所有订单进行数据抓取

http://www.myopencartstore.com/admin/index.php?route=sale/order/info&token=97d9e2f96bb321a6f3506834d6f082e7&order_id=1 http://www.myopencartstore.com/admin/index.php?route=sale/order/info&token=97d9e2f96bb321a6f3506834d6f082e7&order_id=1

   <?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但它看到opencart admin只是自动将我注销,我也尝试过

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它适用于所有带有查询字符串的网站,但是当我将它与 OPENCART ADMIN 一起使用时,它只会让我退出,我知道您可以使用数据库执行此操作,但店主告诉我这样做,您可以帮忙吗

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):您可以查询 Opencart 的数据库(将此 php 文件放在您商店的根目录中,config.php 所在的位置 - 它只是数据库连接详细信息所必需的,因此您不必手动输入详细信息):

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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM