I am attempting to write a simple extension for my site's news interface in PHP. I'm running into a problem with getting the oauth_token from the server - I am unable to connect. I suspect this may be an SSL issue, as I am entirely lost on exactly how SSL plays into this beyond the fact that it is an https connection. The documentation, as far as I can see, only says "Use SSL" but never actually says what for.
A simple little debug page I've been using to test things out: <?php // Create the keypair $res=openssl_pkey_new(); // Get private key openssl_pkey_export($res, $privatekey); // Get public key $publickey=openssl_pkey_get_details($res); $publickey=$publickey["key"]; print "MAKING..."; $TWITTER = new HTTPRequest("https://api.twitter.com/oauth/ request_token/", HTTP_METH_POST) or print ("CANNOT MAKE TWITTER"); print "MADE<br />\n"; print "SETTING UP SSL..."; $TWITTER->setSslOptions(array("ENGINE_DEFAULT" => 1, "PASSWD" => $privatekey)); print "SET UP<br />\n"; print "ADDING HEADERS..."; $TWITTER->addHeaders(array("Authorization" => $auth)) or print ("CANNOT ADD HEADERS"); print "ADDED<br />\n"; print "ADDING POST..."; $TWITTER->setRawPostData($post_stuff); print "ADDED<br />\n"; print "SENDING..."; try { print $TWITTER->send()->__toString(); } catch (HttpException $ex) { print $ex."<br />\n"; } print "SENT<br />\n"; print "REPLY: ".($TWITTER->getRawResponseMessage() or ("NO RESPONSE")); ?> And the resulting output: Authorization: OAuth oauth_nonce="1b3b21dba5a3cbbc01e756bd7159ed3b", oauth_callback="[DEBUG_PAGE]", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1276492389", oauth_consumer_key="[MY_KEY]", oauth_signature="9fbGTC41F65DzFHG8RxRe6rW61A%3D", oauth_version="1.0" Post Data: POST&https%3A%2F%2Fapi.twitter.com%2Foauth %2Frequest_token&oauth_callback%3D[DEBUG_PAGE]%26oauth_consumer_key %3D[MY_KEY]%26oauth_nonce%3D1b3b21dba5a3cbbc01e756bd7159ed3b %26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp %3D1276492389%26oauth_version%3D1.0 MAKING...MADE SETTING UP SSL...SET UP ADDING HEADERS...ADDED ADDING POST...ADDED SENDING...exception 'HttpInvalidParamException' with message 'Empty or too short HTTP message: ''' in [FILE]:56 inner exception 'HttpRequestException' with message 'couldn't connect to server; couldn't connect to host (https://api.twitter.com/oauth/ request_token/)' in [FILE]:48 Stack trace: #0 [FILE](56): HttpRequest- >send() #1 {main} SENT REPLY: 1 So, this is an issue with connecting to the server, likely because the server is expecting SSL. But, what am I supposed to be using SSL on? The documentation at http://dev.twitter.com/auth just says "SSL is recommended" and nothing more. Any help would be much appreciated.