"PHP" uses the Sina API interface and PHP to obtain the remote data of the steps to obtain the IP address, and to obtain the corresponding IP attribution

Source: Internet
Author: User
"PHP" uses the Sina API interface and PHP to obtain remote data, obtain the IP address, and obtain the corresponding IP attribution location

This article and "Servlet" Javaweb, using the Sina API interface, obtain the IP address, and obtain the corresponding IP attribution "(click Open link) for the sister article, but the back-end programming language replaced by PHP.

Make the same effect, open the page, get the client's IP, and get the attribution of this IP using the Sina API interface.


As you can see, it is quite normal in IE6.

Directory structure as follows, very simple, the same two files, in fact, if you would like to write a PHP file can be, but the display layer and the logical business layer is not mixed together as well?

The only notable thing is that these two files can not be called ipget.php,ipget.html, although the suffix is different, but the prefix must not be the same,

Otherwise IE6 don't know why I can't answer this JSON.


Ipgetview.html and "Servlet" Javaweb, using the Sina API interface, obtain IP address, and obtain the corresponding IP attribution (click Open link) in the Display layer page is exactly the same, Sina API interface is identical, here no longer repeat.

 
  Javaweb-ip Query

Ip:

IP attribution to:

Later, ipgetdo.php, like the "PHP" login system and output browser information (click to open the link), the use of ${_server[' REMOTE_ADDR '} first obtain the user's IP, and then through the curl to remote data acquisition. PHP uses curl to get data remotely in the following format:

 
  

So ipgetdo.php code is as follows, get data, print it directly, let Ipgetview.html get it with Ajax.

 
  

  • 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.