繁体   English   中英

Opencart 管理数据抓取

[英]Opencart Admin Data Scraping

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

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

但它看到opencart admin只是自动将我注销,我也尝试过

https://import.io/ a web scrapping tool

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

您可以查询 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