A problem with curl grabbing WeChat web pages

WBOY
Release: 2016-08-08 09:06:52
Original
1018 people have browsed it

Today, the boss of the company asked me to grab a WeChat webpage. I used curl to get its json, but I couldn’t get the static html of this webpage. I don’t know how to use this captured json data to display the page. The json package contains the content of the page

————
The json is too long and I can’t post it all directly. I put it on the server. Can you guys help me take a look? Thank you. Been working on this thing for a whole day↓↓↓↓↓

JSON format address

JS file address

Reply content:

Today, the boss of the company asked me to grab a WeChat webpage. I used curl to get its json, but I couldn’t get the static html of this webpage. I don’t know how to use this captured json data to display the page. The json package contains the content of the page

————
The json is too long and I can’t post it all directly. I put it on the server. Can you guys help me take a look? Thank you. Been working on this thing for a whole day↓↓↓↓↓

JSON format address

JS file address

Thank you for the invitation. It means that the data that should be obtained has been successfully obtained, but the html of this page is in the jsondata, right? Can't you parse the corresponding html from json? First convert the data format through the json_decode function of php, and then extract the html. Hope it helps you

Post the json data to see if it contains HTML code. If there is html code, append it directly to the HTML browser and it will parse it normally. I just looked at the json data. This should be the data of a list page on the e-commerce website. , can be roughly divided into header data, main content, and footer data. You can convert json into a PHP array and then traverse it, but you need to provide the HTML static and style of the page. This json mainly provides the product information of the page.

You can obtain the jsondata

by rendering the page you want to copy.

Use json_decode to decode and extract the html, and then rudely echo it to the web page or process it before putting it in.

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template