PHP through Ajax calls to connect Baidu effect to detect whether the site is connected to the function of

Source: Internet
Author: User
This article mainly introduces PHP through the AJAX call to connect Baidu effect to detect whether the Web site is connected to the function of interested friends under the reference, I hope to help you.

In this paper, the method of Php+ajax real-time automatic detection is described, and the implementation method is as follows:

HTML Part code:

<! DOCTYPE Html>

PHP Section Code:

Public Function Getnetlink () {   header ("Cache-control:no-cache,must-revalidate");   Header ("Content-type:text/html;charset=utf-8");   $file =fopen ("http://www.baidu.com/", "R");   if (! $file) {    $shownetlink = "<font color=\" red\ "> Network connection Failed </font>";   } else{    $shownetlink = "<font color=\" #06C \ "> Network connection Normal </font>";   }   Echo $shownetlink; }

Summary : The above is the entire content of this article, I hope to be able to help you learn.

Related recommendations:

The definition and implementation of PHP for event mechanism

PHP-based method for skin changing with cookies

Three common uses of PHP analog post requests

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.