3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php session_start(); $redirect_uri = 'http://path/to/app/callback'; $url = 'https://getpocket.com/v3/oauth/request'; $data = array('consumer_key' => '27963-b8ab8bc16d50240c6b5aa93b', 'redirect_uri' => $redirect_uri); // use key 'http' even if you send the request to https://... $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded; charset=UTF-8", 'method' => 'POST', 'content' => http_build_query($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); $request_token = str_replace('code=','',$result); $_SESSION['request_token'] = $request_token; header("Location: https://getpocket.com/auth/authorize?request_token=$request_token&redirect_uri=$redirect_uri"); die(); ?>
Output for 5.4.34 - 5.4.38, 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/4ddM4 on line 16 Warning: file_get_contents(https://getpocket.com/v3/oauth/request): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/4ddM4 on line 16 Warning: Cannot modify header information - headers already sent by (output started at /in/4ddM4:16) in /in/4ddM4 on line 22
Output for 5.4.39 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/4ddM4 on line 16 Warning: file_get_contents(https://getpocket.com/v3/oauth/request): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/4ddM4 on line 16 Warning: Cannot modify header information - headers already sent by (output started at /in/4ddM4:16) in /in/4ddM4 on line 22
Output for 5.3.0 - 5.4.32
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/4ddM4 on line 16 Warning: file_get_contents(https://getpocket.com/v3/oauth/request): failed to open stream: No such file or directory in /in/4ddM4 on line 16 Warning: Cannot modify header information - headers already sent by (output started at /in/4ddM4:16) in /in/4ddM4 on line 22
Output for 5.2.3 - 5.2.17
Notice: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/4ddM4 on line 16 Warning: file_get_contents(https://getpocket.com/v3/oauth/request): failed to open stream: No such file or directory in /in/4ddM4 on line 16 Warning: Cannot modify header information - headers already sent by (output started at /in/4ddM4:16) in /in/4ddM4 on line 22
Output for 5.0.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/4ddM4 on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/4ddM4:2) in /in/4ddM4 on line 2 Notice: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/4ddM4 on line 16 Warning: file_get_contents(https://getpocket.com/v3/oauth/request): failed to open stream: No such file or directory in /in/4ddM4 on line 16
Output for 4.4.5 - 4.4.9
Warning: session_start(): Cannot send session cookie - headers already sent in /in/4ddM4 on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/4ddM4:2) in /in/4ddM4 on line 2 Fatal error: Call to undefined function: http_build_query() in /in/4ddM4 on line 12
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Warning: session_start(): Cannot send session cookie - headers already sent in /in/4ddM4 on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/4ddM4:2) in /in/4ddM4 on line 2 Fatal error: Call to undefined function: http_build_query() in /in/4ddM4 on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent in /in/4ddM4 on line 2 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/4ddM4:2) in /in/4ddM4 on line 2 Fatal error: Call to undefined function: http_build_query() in /in/4ddM4 on line 12