php方法
function curlpost($data,$url){ $data=array(‘data‘=>$data); $ch = curl_init (); curl_setopt ($ch, CURLOPT_URL, $url ); curl_setopt ($ch, CURLOPT_POST, true ); curl_setopt ($ch, CURLOPT_HEADER, 0 ); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ($ch, CURLOPT_POSTFIELDS, $data ); $state=curl_exec ($ch ); curl_close ($ch ); // return $state;//返回另外一个平台传过来的值 }
PHP使用方法
$data=array(); $data[‘type‘]=2; $data[‘channel‘]=$channel; $data[‘uid‘]=$uid; $data[‘code‘]=$code; $url="http://www.fenxiu2.com/index/Uniquelink/getcode.html //此方法不行就用下面的写法 //$url="http://www.fenxiu2.com/index/Uniquelink/getcode.html?type=2&channel=$channel&uid=$uid&code=$code"; curlpost($data,$url);