我偶然发现了使用经过身份验证的连接的问题。我不想检索带有特定标签的私人帖子。目前,我收到状态为 200 的错误消息为空,无法再做任何事情。代码(几乎与您的文档中相同:
$request_data = http_build_query(array('email'=>$thumblr['email'],'password'=>$thumblr['pass']));
//$c = curl_init("http://".$thumblr['acc_name'].".tumblr.com/api/read?tagged=".$thumblr['the_tag']);
$c = curl_init("http://www.tumblr.com/api/authenticate");
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $request_data);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($c);
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
if ($status == 201) {
echo "Success! The new post ID is $result.\n";
} else if ($status == 403) {
echo 'Bad email or password';
} else {
echo "Error [$status]: $result\n";
}
输出是:
Error [200]:
帮助?:)