This is a very useful distance calculation function that calculates the distance from location A to B using latitude and longitude. The function can return miles, kilometers, and oceans of three unit types of distance.
function
Class Httptool
{
/**
*//Get domain name or host address
* #测试网址: http://localhost:8081/test/testurl.php?id=5
* Return to localhost:8081
*/
Public Function GetHost ()
{
Return $_server[' Http_host '];
/*
* Remote picture gets to local
*/
function Grabimage ($url) {
if ($url! = "") {//If the picture address is empty
$ext = STRRCHR ($url, '. '); Determine the format of a picture
if ($ext! = '. jpg ' && $ext! = '. gif '
!--? php
$patterns = "/\d+/";//First type
// $patterns = "/\d/"; The second type of
$strs = "left:0px;top:202px;width:90px;height:30px";
Preg_match_all ($patterns, $strs, $arr);
Print_r ($arr);
/**
Desc: The code that collects the mailboxes in a Web page
*/
$url = ' http://www.xxx.net '; The URLs to be collected
$content =file_get_contents ($url);
Echo $content;
function Getemail ($STR) {
$pattern =
There is a guess the user likes the function, the user can click to change a group, to refresh the recommended content. The First gets the first 1000 data through a database query, and then randomly strips 4. After the program has finished
In many occasions in order to show the timeliness of information, the time is generally displayed as "just", "5 minutes Ago", "3 hours ago", and so on, rather than directly print out the time. such as microblogging, SNS applications for the longest
Use the following function to get the full details of any domain user
function Whois_query ($domain) {
Fix the domain name:
$domain = Strtolower (Trim ($domain));
$domain = preg_replace ('/^http:\/\//i ', ' ', $domain)
function Getrealipaddr ()
{
if (!emptyempty ($_server[' http_client_ip '))
{
$ip =$_server[' http_client_ip '];
}
ElseIf (!emptyempty ($_server[' http_x_forwarded_for '))
To check IP was pass from proxy
function plural ($num) {
if ($num! = 1)
return "S";
}
function Getrelativetime ($date) {
$diff = time ()-Strtotime ($date);
if ($diff The
return $diff. "Second". Plural ($diff). "Ago";
//$low and $high has to be integers
function BinarySearch ($array, $key, $low, $high)
{
if ($low > $high)//T Ermination case
{
return-1;
}
$middle = Intval (($low +
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