make `Switch` constructor more precise
[hiphop-php.git] / hphp / test / slow / ext_oauth / rsa.php
blobd05362ae7cf6ca7a51b4453646635eab7283a8b7
1 <?hh
2 require 'server.inc';
3 <<__EntryPoint>> function main(): void {
4 $x = new OAuth('1234', '', OAUTH_SIG_METHOD_RSASHA1);
5 $x->setRequestEngine(OAUTH_REQENGINE_STREAMS);
6 $x->setTimestamp(12345);
7 $x->setNonce('testing');
8 $x->setRSACertificate(file_get_contents(dirname(__FILE__).'/test.pem'));
10 $output = null;
11 $port = random_free_port();
12 $pid = http_server("tcp://127.0.0.1:$port", varray[
13 "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 40\r\n\r\noauth_token=1234&oauth_token_secret=4567",
14 ], inout $output);
16 $x->setAuthType(OAUTH_AUTH_TYPE_URI);
17 var_dump($x->getRequestToken("http://127.0.0.1:$port/test"));
19 fseek($output, 0, SEEK_SET);
20 var_dump(stream_get_contents($output));
22 http_server_kill($pid);