1
ejin 2013-02-01 12:28:23 +08:00
最简单的方法就是看看返回什么,然后诊断,不过看你这个提交没有带上来源页吧。很容易被判断成外站提交的。
|
2
Part 2013-02-01 12:52:35 +08:00 1
<?php
$post_data = array(); $post_data['longUrl'] = "http://www.baidu.com"; $post_data['note'] = "baidu.com"; $post_data['private'] = "false"; $post_data['title'] = "Baidu Search engine"; $ch = curl_init('https://bitly.com/data/beta/save'); /////////////////////////////////////////////////// $temp = ''; foreach ($post_data as $k=>$v){ $temp.= "$k=".utf8_encode($v)."&"; } $post_data=substr($temp,0,-1); /////////////////////////////////////////////////// curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_exec($ch); ?> |
3
hulk 2013-02-01 14:59:35 +08:00
<?php
$post_data = array(); $post_data['longUrl'] = "http://www.baidu.com"; $post_data['note'] = "baidu.com"; $post_data['private'] = "false"; $post_data['title'] = "Baidu Search engine"; $ch = curl_init('https://bitly.com/data/beta/save'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 curl_setopt($ch, CURLOPT_TIMEOUT, 30);//可不能让我等半天好么 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); // 从证书中检查SSL加密算法是否存在 curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); $re=curl_exec($ch); if (curl_errno($ch)) { echo 'Errno'.curl_error($ch);//捕抓异常 } curl_close($ch); // 关闭CURL会 var_dump($re); https post跟普通的post有点不一样,需要检查证书,url_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);跳过... 还有这个网站有点慢.3秒还一堆超时 |
5
laoyuan 2013-02-02 21:01:51 +08:00
一开始都难,记住,just do it!
http://v2ex.com/t/57864 |
6
road2stat 2013-02-04 03:09:02 +08:00
|