<?php
$mobile_home
=
new
mobile_home();
$mobile_home
->set_mobile(18606240180);
$data
=
$mobile_home
->showji();
class
mobile_home {
public
$mobile
;
public
function
set_mobile(
$mobile
) {
$this
->mobile =
$mobile
;
$this
->checklen();
}
public
function
checklen() {
if
(
strlen
(
$this
->mobile) !=
"11"
) {
die
(
"手机号码有误"
);
}
}
public
function
showji() {
$data
=
$this
->get('http:
if
(
is_array
(
$data
)) {
return
$data
;
}
}
private
function
get(
$urll
,
$cookie
= '',
$referer
= '') {
$ch
= curl_init();
curl_setopt(
$ch
, CURLOPT_URL,
$urll
);
curl_setopt(
$ch
, CURLOPT_HEADER, 0);
curl_setopt(
$ch
, CURLOPT_REFERER,
$referer
);
curl_setopt(
$ch
, CURLOPT_RETURNTRANSFER, true);
curl_setopt(
$ch
, CURLOPT_COOKIE,
$cookie
);
$content
= curl_exec(
$ch
);
curl_close(
$ch
);
return
json_decode(
$content
, true);
}
}
?>