file_get_contents()
Warning: file_get_contents(https//tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=18111111111): failed to open stream: No error in G:\wamp64\www\number\libs\ImHttpRequest.php on line 21
代码:
<?php
namespace libs;
class ImHttpRequest {
public static function request($url,$params = [],$method='GET'){
$response = null ;
if($url){
$method = strtoupper($method);
if($method == 'POST'){
}elseif($method == 'PUT'){
}elseif ($method == 'DELETE'){
}else {
if(is_array($params) and count($params) ){
if(strripos($url,'?')){
$url = $url.'&'.http_build_query($params);
}else {
$url = $url.'?'.http_build_query($params);
}
$response = file_get_contents($url);
}
}
}
return $response;
}
}
?>