php curl利用嘀咕、搜狐微博API发布微博
作者:寒川 发布于:2010-8-3 8:57 Tuesday 分类:网页编程
嘀咕、搜狐微博API使用昨晚简单地研究了一下,下面是用php curl利用嘀咕、搜狐微博API发布微博,具体如下:
<?php
$username = 'xieyanwei51';
$password = '123456;
$content='别怕,这是PHP利用API发送的微博!';
//以下是SOHU微博API的使用。
$url = 'http://api.t.sohu.com/statuses/update.xml';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_POSTFIELDS,'status='.urlencode($content)) ;
curl_setopt($curl, CURLOPT_HEADER, 0);//1显示头,0不显示头。
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//禁止返回status的状态。
curl_exec($curl);
curl_close($curl);
//以下是嘀咕API的使用。
$url = 'http://api.minicloud.com.cn/statuses/update.format';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_POSTFIELDS,'content='.urlencode('sorry for emlog')) ;
curl_setopt($curl, CURLOPT_HEADER, 0);//1显示头,0不显示头。
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//禁止返回status的状态。
curl_exec($curl);
curl_close($curl);
?>
日志分类
最近日志
随机日志
最新评论
- CCC certification
对这块还真是不... - 那风筝
happy new year ! - Roy
你好, 交换个链... - 太阳城娱乐网
说实话,对钛白... - 卡特&&艾弗森
不错啊!!,过段... - 奇遇
沙发 - 寒川
@Mr.邱℡:现在可... - Mr.邱℡
曾经加过,失效... - 寒川
@欧盛网络:链接... - 欧盛网络
换个链接好不?...
日志档案
- 2011年11月(2)
- 2011年9月(1)
- 2011年8月(2)
- 2011年7月(2)
- 2011年5月(1)
- 2011年3月(3)
- 2011年2月(2)
- 2010年12月(1)
- 2010年11月(2)
- 2010年10月(3)
- 2010年9月(9)
- 2010年8月(8)
- 2010年7月(13)
- 2010年6月(18)
- 2010年5月(24)
- 2010年4月(10)
- 2010年3月(14)
- 2010年2月(6)
- 2010年1月(7)
- 2009年11月(2)
- 2009年10月(3)
- 2009年9月(3)
- 2009年8月(8)
- 2009年7月(15)
- 2009年6月(14)
- 2009年4月(2)
- 2008年12月(1)
- 2008年6月(1)
- 2008年5月(10)
- 2008年4月(9)
- 2008年3月(5)
- 2008年2月(2)
- 2008年1月(5)
- 2007年12月(4)
- 2006年9月(6)
- 2006年7月(1)



发表评论: