Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does PHP cooperate with fiddler to grab Wechat Index Mini Program data

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how PHP cooperates with fiddler to grab Wechat Index Mini Program data, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

The details are as follows:

I have studied the Wechat index these two days. To grab, according to the general idea, that is to use fiddler to grab the mobile phone bag, then analyze it to obtain the address and then request it.

You are right to think so. If you do so decisively, it will be too yang too simple. As you can see, Wechat crawling has the following steps:

1. Start logging on Mini Program

2. Obtain the token required for access

3. Then this token to get the data.

First of all, the difficulty is the landing step of Mini Program. You have to log in to Wechat before you can access Mini Program, because Mini Program is based on Wechat. Therefore, you need to use the value of js_code generated internally by Wechat when you log in. This step alone is a bottomless pit.

Well, in the case of 1/100000000 probability, you get this value, and then you get the search_key value, and then you get a UNIX timestamp.

When you're done, you can get the data you want?

As a teenager, you should keep to the point of being a man. Wechat has a system of access restrictions. Request to a certain frequency, will prompt frequent operations. So after you've gone to a lot of trouble to get it done, there's still no practical result.

Online there is a solution is to use Lua language with touch wizard to write a script to operate Wechat, similar to automatically grab red packets. Use this script to automatically enter keywords for query, and then use the packet grabbing tool to get the request content.

For those of you who are not clear about using the package grab tool to obtain the content of the request, please refer to: https://www.xuebuyuan.com/article/177679.htm

Not to mention the success rate of this scheme. Let's talk about efficiency first. Is it difficult, if you do so, Wechat will not limit your request?

And then there are the various costs of learning a language.

Therefore, I use PHP combined with fiddler package grabbing tool to design a simple, easy-to-learn program to grab data. Let me tell you one by one:

The first is to configure fiddler to save the crawled data locally.

Reference link: https://www.xuebuyuan.com/article/177679.htm

This is used to obtain the access token, and the core PHP code is as follows:

Function get_search_key ($path) {$file = fopen ($path, "r"); $user=array (); $iTun0; while (! Feof ($file) {$user [$I] = mb_convert_encoding (fgets ($file), 'UTF-8','Unicode'); $iTunes;} fclose ($file); $user=array_filter ($user); foreach ($user as $item_u = > $value_u) {if (strstr ($value_u, "search_key=")) {$temp [] = $value_u;}} $end_url = end ($temp) $reg = "# openid= [a-zA-Z0-9] + _ [a-zA-Z0-9] + + & search_key=\ dholders _\ d++#isU"; preg_match_all ($reg,$end_url,$time); return $time [0] [0];}

Enter the address to save the file, get the return value, take this return value, make the request, and you can get the data you want.

But this thing is also flawed. The first thing is to configure the phone to connect to the computer, which I will add in the comments later. Next is to configure fiddler to save the package to the local file. In addition, you need a mobile phone to access Mini Program before the program can run successfully. It's troublesome.

Thank you for reading this article carefully. I hope the article "PHP how to cooperate with fiddler to grab Wechat Index Mini Program data" shared by the editor is helpful to everyone. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report