drxpt06820 2018-01-23 01: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 03: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条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部