$url = 'http://www.cnblogs.com/api/say';
$data = array('username' => 'test',
              'words'    => 'hello world');

$data = http_build_query($data);
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
$response = curl_exec($ch);
curl_close($ch);
posted on 2013-03-06 10:03  狐狸v  阅读(208)  评论(0编辑  收藏  举报