WordPress Tutorial

How does WordPress detect whether there are anti links and friendship links on the other website

 Alibaba Cloud

Recently, cloud template is customizing an anti chain management plug-in for a customer. It needs to automatically detect whether anti chain friend chains exist. How to detect anti chain? The Dom of PHP can be used to determine whether the href of tag a exists.

The core code is given below:

Want to be here? contact us bar
 Maker host
  1.  $body  =  'test <a href=" https://www.22vd.com ">22vd</a> test' ; //Get the html of the other party's website
  2.  $dom  =  new DomDocument ( ) ;
  3.  $dom -> loadHTML ( $body ) ;
  4.  $xpath  =  new DOMXPath ( $dom ) ;
  5.  foreach  ( $xpath -> query ( '//a[contains(@href, " https://www.22vd.com ")]' )  as  $a )  {
  6.      echo  'success' ;
  7.  }

The foreach above can tell whether there is anti chain.

How does WordPress detect whether there are anti links and friendship links on the other website

164 people have bought
View Demo Upgrade VIP Buy Now

Collection
fabulous ( zero )

Post reply

Hot selling template

Ashade - Works exhibition photo album WordPress Chinese theme
 LensNews

This site accepts WordPress/PbootCMS/DedeCMS, etc
System construction, imitation, development, customization and other services!