douguaidian8021 2012-02-07 07:26 采纳率: 100%
浏览 48
已采纳

使用PHP从网站上抓取数据[关闭]

I am trying to gather information into a text file, that I will later be uploading to a MySQL database. I am trying to gather all of the PS3 trophy information. I will be using this website : http://www.ps3trophies.org/games/psn/1/ to gather the information. What I need to do is go inside each game on every single page, get the game name, and each of the trophies and all of the information about them. Thanks for any info you can give me.

  • 写回答

3条回答 默认 最新

  • dongtuo7364 2012-02-07 07:34
    关注

    I recommend using the Simple HTML DOM Parser to do this. You can use jQuery/CSS selectors to navigate elements on the page. You could do something like this:

    $html = file_get_html('http://www.ps3trophies.org/games/psn/1/');
    $otherPages = $html->find('a[href^=/games/psn/]'); // this will get the links for the 7 other pages
    

    And then you can also build a selector for all the games pages, and load them. Read through the parser documentation for all the stuff you can do.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决