drxpt06820 2018-01-23 09:27
浏览 78
已采纳

使用PHP解析卸载的HTML

So I am trying to parse HTMl from a website but all I get is menu because body has a preloader. Links are NSFW so I added a wildcard to them. My question is how do I parse whole page and not only menu? Creating a timeout doesn't seem to help (or I am doing the timeout wrong).

<?php
    $ctx = stream_context_create(array( 
        'http' => array( 
            'timeout' => 50
            ) 
        ) 
    ); 
    $stars_list_page = file_get_contents("https://www.por*pics.com/?q=blue+angel", 0, $ctx); 

        $dom_obj = new DOMDocument();
        @$dom_obj->loadHTML($stars_list_page);
        var_dump($dom_obj);


    ?>
  • 写回答

2条回答 默认 最新

  • dongyiyu882684 2018-07-16 11:30
    关注

    6 months later I realize how rude I was and didn't answer my own question for future visitors after finding solution.

    I went to network tab in developer tools and under XHR I found the URL server is making requests towards to load more data.

    If you are having trouble recreating the request try this awesome tool, works with more languages: https://curl.trillworks.com/

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

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号