0

任何人都认为这有什么问题,它不起作用并且返回 null。

$request = array(
  "api_token" => $token,
  "name" => null,
  "byline" => "via api",
  "owner_id" => null,
  "id" => $id,
  "raw_theme" => $t,
  "friendly_name" => "Test"
);


$session = curl_init($url);
curl_setopt($session, CURLOPT_USERPWD, $user . ":" . $password);
curl_setopt($session, CURLOPT_POST, true);
curl_setopt($session, CURLOPT_POSTFIELDS, $request);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);
var_dump($response);
4

1 回答 1

2

我不确定,但如果我尝试从https://posterous.com/api发送一个创建新主题的请求,那么帖子参数的名称如下:

theme[byline]
theme[designer_url]
theme[friendly_name]
theme[raw_theme]
theme[thumb]

因此,也许您应该尝试将代码更改为:

$request = array(
  "api_token" => $token,
  "name" => null,
  "theme[byline]" => "via api",
  "owner_id" => null,
  "id" => $id,
  "theme[raw_theme]" => $t,
  "theme[friendly_name]" => "Test"
);

另外,我在他们的示例中看不到任何owner_id, nameorid参数。

于 2012-01-14T10:45:45.063 回答