protected function http_post_data($url, $httpHeader, $data_string)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader);
ob_start();
curl_exec($ch);
$return_content = ob_get_contents();
ob_end_clean();
return $return_content;
}
$lHeader = array('Content-Type: application/json;');
$larr = array('login_id'=>1,
'password'=>'1');
$lurl = http://www.example.com/functionName;
$lparam = json_encode($larr);
$lreturn = $this->http_post_data($lurl, $lHeader, $lparam);
$loginReturn = json_decode($lreturn);
if($loginReturn->error_code == 0)
{
// 相应处理
}