<?php
function send_http($url,$postdata=false){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($postdata){//post请求
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
转载于:https://my.oschina.net/guodingding/blog/667974