php crawler for website with ajax content and https

江枫思渺然 提交于 2020-01-17 05:18:35

问题


i'm trying to grab the content of a website based on ajax and https but with no luck.

Is this possible.

The website i'm trying to crawl is this:

https://www.bet3000.com/en/html/home.html#!https://www.bet3000.com/html/en/eventssportsbook.html?category_id=2117

Thanks


回答1:


If you take a look at the HTTP requests that this page is doing (using, for example, Firebug for Firefox), you'll notice it makes several Ajax requests.

Instead of trying to execute the Javascript code, a possible solution could be for you to request one of those URLs, and get the data -- you'd also not have to parse the HTML, this way.


In this specific case, one of those requests is made to the following URL :

https://www.bet3000.com/ajax/en/sportsbook.json.html?category_id=2117&offset=&live=&sportsbook_id=0

This URL seems to return some JSON data, that should interest you quite a bit ;-)
(There is a few characters before and after the JSON, that will need to be removed, but, asides from that, I don't see anything that doesn't look good.)



来源:https://stackoverflow.com/questions/6910804/php-crawler-for-website-with-ajax-content-and-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!