1
我试图获得与REST API的应用程序状态和我有一点无法得到它返回好数据Heroku JSON REST API的PHP示例?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.heroku.com'); // No clue what to put here.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, ":yesthisismyrealapikeyanditworks"); // trust me on this line :)
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); //total guess
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'https://api.heroku.com/apps/myapp/ps'); // where myapp is actually my app name
// Getting results
return curl_exec($ch);
这还没有恢复任何有用的东西。我是JSON和卷曲的新手,请尽量轻松一点。谢谢。
戴夫
_ “这还没有恢复任何用处。” _ - 确定。那么它返回的是什么? –
对不完整的问题。我收到了一些返回数据,其中一种情况是为我创建新的dynos,而不是发送ps状态。虽然没有任何有用的错误。 –