Created
July 1, 2013 14:07
-
-
Save sagotsky/5901066 to your computer and use it in GitHub Desktop.
Updates a topic on getsaitsfaction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Attempting to update a getsatisfaction topic from the api. | |
*/ | |
set_include_path('/opt/pear'); | |
require_once('HTTP/Request2.php'); | |
$url = 'https://api.getsatisfaction.com/topics/api_topic_test'; //slug works here. haven't tested id. | |
$topic = array( | |
'topic' => array( | |
'subject' => 'API -> Topic test', | |
'style' => 'idea', | |
'status' => 'pending', | |
'additional_detail' => 'additional detail updated by put', | |
), | |
); | |
$username = 'AzureDiamond'; | |
$password = 'hunter2'; | |
#$request = new HTTP_Request2($url, HTTP_Request2::METHOD_POST); | |
$request = new HTTP_Request2($url, HTTP_Request2::METHOD_PUT); | |
$request->setAuth($username, $password, HTTP_Request2::AUTH_BASIC); | |
$request->setHeader('Content-type: application/json'); | |
$request->setBody(json_encode($topic)); | |
$request->setConfig(array('ssl_verify_peer'=>FALSE, 'ssl_verify_host'=>FALSE)); | |
$response = $request->send(); | |
$body = $response->getBody(); | |
echo $body; | |
?> |
hmmm i take that back :-) my bad!
my ruby code posts replies using HTTP POST , it doesn't modify using HTTP PUT
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice php code! i have ruby code for this at: https://github.com/rtanglao/momogs/blob/master/postReply.rb if anybody is looking for ruby