php implements of 360 for obtaining record information of websites

  • 2020-09-28 08:48:41
  • OfStack


<?php   
 // WebSite http://www.micxp.com  
function miibeian($domain) {   
    $domain = base64_encode ( $domain );   
    $opts = array (   
            'http' => array (   
                    'method' => "GET",   
                    'timeout' => 5    
            )    
    );   
    $context = stream_context_create ( $opts );   
    $url = 'http://webid.360.cn/complaininfo.php?domain=' . $domain;  
    $html = file_get_contents ( $url, false, $context );   
    if (strpos ( $html, ' No web site information was found ' )) {   
        return false;   
    }   
    $flag = '<ul>';   
    $start = strpos ( $html, $flag ) + strlen ( $flag );   
    $info = substr ( $html, $start, strpos ( $html, '</ul>' ) - $start );   

    $info = str_replace ( ' ', '', $info );   
    $info = str_replace ( '<li><strong> Web site name :</strong>', '', $info );   
    $info = str_replace ( '<li><strong> Homepage address :</strong>', '&nbsp;', $info );   
    $info = str_replace ( '<li><strong> Name of Sponsor :</strong>', '&nbsp;', $info );   
    $info = str_replace ( '<li><strong> Nature of Sponsor :</strong>', '&nbsp;', $info );   
    $info = str_replace ( '<li><strong> Audit time :</strong>', '&nbsp;', $info );   
    $info = str_replace ( '<li><strong> Web site for the record / license :</strong>', '&nbsp;', $info );   
    $info = str_replace ( "\r\n", '', $info );   
    $info = str_replace ( '</li>', '', $info );   
    $info = trim ( $info );   
    $temp = explode ( '&nbsp;', $info );   
    return $temp;   
}   
// http://webid.360.cn/complaininfo.php?domain=c3lzeXVuLmNvbQ==  
$result = miibeian ( 'ofstack.com' );   
print_r ( $result ); 

Related articles: