1.发送get请求
file_get_contents('请求地址');
2.发送post请求
$info=['eat'=>'2kg','run'=>'10km'] ; $url='http://localhost'; $context =
stream_context_create(array( 'http' => array( 'method' => 'POST', 'header'
=> 'Content-type:application/x-www-form-urlencoded', 'content' =>
http_build_query($info), 'timeout' => 20 ) )); $result =
file_get_contents($url, false, $context);
3.下载图片
file_put_contents('aa.jpg',file_get_contents('https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2310514390,3580363630&fm=27&gp=0.jpg'));
提供免费API接口:http://www.wangshuwen.com/portal/article/detail/id/12.html
<http://www.wangshuwen.com/portal/article/detail/id/12.html>
热门工具 换一换