欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【PHP curl新浪微博发信接口】,下面是详细的分享!
PHP curl新浪微博发信接口
<?php
function sendmicroblog($a, $b, $c) {
$d=tempnam('./', 'cookie.txt'); //创建随机临时文件保存cookie.
$ch=curl_init("https://login.sina.com.cn/sso/login.php?username=$a&password=$b&returntype=TEXT");
curl_setopt($ch, CURLOPT_COOKIEJAR, $d);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, "FengYin");
curl_exec($ch);
curl_close($ch);
unset($ch);
$ch=curl_init($ch);
curl_setopt($ch, CURLOPT_URL, "http://t.sina.com.cn/mblog/publish.php");
curl_setopt($ch, CURLOPT_REFERER, "http://t.sina.com.cn");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "content=".urlencode($c));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $d);
curl_exec($ch);
curl_close($ch);
unlink($d);//删除临时文件.
}
?>
以上所分享的是关于PHP curl新浪微博发信接口,下面是编辑为你推荐的有价值的用户互动:
相关问题:新浪微博调用接口 php实现
答:同步用户资料? 不知道你是要怎麼同步呢 如果只是要户鹰眼网站的用户能在益云平台登录的话,直接把用户资料插进益云平台的数据库即可,然后再写一个程序,当有新用户在户鹰眼注册,则在益云平台内加一条用户记录,这样可以保证新的用户也能登录 ... >>详细
相关问题:新浪API如何通过PHP的CURL函数来调用
答:这个是从sina的php sdk中找到的,其他的函数就不贴出来了,你直接下来看一下就知道了。 我建议你直接使用sina提供的php sdk function http($url, $method, $postfields = NULL, $headers = array()) { $this->http_info = array(); $ci = curl_i... >>详细
相关问题:如何用PHP连接 curl方式的接口
答:-H 表示curl命令的header,对应php中可以使用:$header = array("X-Udemy-Client-Id: MYCLIENTID","X-Udemy-Client-Secret: MYCLIENTSECRET",);curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //$ch = curl_init($url);更多关于curl的应用可以... >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
