Mechanism and implementation of wechat domain name detection

Posted by mr00047 on Fri, 12 Jun 2020 09:27:30 +0200

       <!-- /\* Font Definitions \*/ @font-face {font-family:Tahoma; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Microsoft YaHei ; panose-1:2 11 5 3 2 2 4 2 2 4; mso-font-charset:134; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-2147483001 672087122 22 0 262175 0;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-520081665 -1073717157 41 0 66047 0;} @font-face {font-family:"Segoe UI Symbol"; panose-1:2 11 5 2 4 2 4 2 2 3; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:3 0 0 0 1 0;} @font-face {font-family:Consolas; panose-1:2 11 6 9 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:-520092929 1073806591 9 0 415 0;} @font-face {font-family:"\\@Tahoma"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;} @font-face {font-family:"\\@Microsoft YaHei "; panose-1:2 11 5 3 2 2 4 2 2 4; mso-font-charset:134; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-2147483001 672087122 22 0 262175 0;} /\* Style Definitions \*/ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; mso-pagination:widow-orphan; layout-grid-mode:char; mso-layout-grid-align:none; font-size:11.0pt; font-family:"Tahoma","sans-serif"; mso-fareast-font-family:Microsoft YaHei ; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} h1 {mso-style-priority:9; mso-style-unhide:no; mso-style-qformat:yes; mso-style-link:"Title 1 Char"; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; mso-outline-level:1; font-size:24.0pt; font-family:Tahoma; mso-bidi-font-family:Tahoma;} span.1Char {mso-style-name:"Title 1 Char"; mso-style-priority:9; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:"Title 1"; mso-ansi-font-size:24.0pt; mso-bidi-font-size:24.0pt; font-family:Tahoma; mso-ascii-font-family:Tahoma; mso-fareast-font-family:Tahoma; mso-hansi-font-family:Tahoma; mso-bidi-font-family:Tahoma; mso-font-kerning:18.0pt; font-weight:bold;} span.hljs-number {mso-style-name:hljs-number; mso-style-unhide:no;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:11.0pt; mso-ansi-font-size:11.0pt; mso-fareast-font-family:Microsoft YaHei ; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:0pt;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:11.0pt;} /\* Page Definitions \*/ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page WordSection1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.WordSection1 {page:WordSection1;} /\* List Definitions \*/ @list l0 {mso-list-id:279725072; mso-list-template-ids:-1797495592;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->   

Mechanism and implementation of wechat domain name detection

We usually encounter wechat activities because a wechat page needs to be shared. If the page is shared to a certain number of times and views by fans, there will be a limit. If it is opened, it will be blocked by wechat for many times. As a result, all sharing will be done in vain. Generally, the following display interface will appear, as shown in the figure:

Quantity data will also be lost, WeChat page activities to promote marketing mode change, this know how to do WeChat official account will understand. So we need a "wechat anti blocking domain name is blocked detection" that can be monitored from time to time. Wechat anti seal domain name

There is a function. If we find that it is blocked, we can be ready to change the "domain name" or "url link" in time at any time, so that the fans' data will not be lost and the columns will be changed normally. This function now has an open interface for research. See the trial cases:

  1. $url = "http://api.monkeyapi.com";
  2. $params = array(
  3. 'appkey' =>'appkey',_ //__ You applied for__ APPKEY_
  4. 'url' =>' www.url.com ', //__ Websites to query_
  5. )Add q consultation if you don't understand: 510124737 -- >
  6. $paramstring = http\_build\_query($params);
  7. $content = Curl($url, $paramstring);

10.$result = json\_decode($content, true);

11.if($result) {

  1. var_dump($result);

13.}else {

  1. //__ Request exception

15.} < < add q consultation if you don't understand: 510124737 -- >

17.

18._/**_

  1. * Request interface return content_
  2. * @param_ string $url [requested__ URL__ Address]
  3. * @param_ string $params [__ please

Parameters of_ ]

  1. * @param_ int $ipost__ POST__ Form]
  2. * _@return_ string

24._*/_

25.function Curl($url, $params = false, $ispost = 0)

26.{

  1. $httpInfo = array();
  2. $ch = curl_init();

29.

  1. curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  2. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
  3. curl_setopt($ch, CURLOPT_TIMEOUT, 60);
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  6. if ($ispost) {
  7. curl_setopt($ch, CURLOPT_POST, true);
  8. curl_setopt($ch, CURLOPT\_POSTFIELDS, $params);
  9. curl_setopt($ch, CURLOPT\_URL, $url);
  10. }else {
  11. if ($params) {
  12. curl_setopt($ch, CURLOPT\_URL, $url.'?'.$params);
  13. } else {
  14. curl_setopt($ch, CURLOPT\_URL, $url);
  15. }
  16. }

46.

  1. $response = curl\_exec($ch);
  2. if ($response === FALSE) {
  3. //echo "cURL Error: " . curl_error($ch);
  4. return false;
  5. }

52.

  1. $httpCode = curl\_getinfo($ch, CURLINFO_HTTP_CODE);
  2. $httpInfo = array\_merge($httpInfo, curl_getinfo($ch));
  3. curl_close($ch);
  4. Add q consultation if you don't understand: 510124737 -- >

Topics: Java curl ascii JSON