3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
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(): open_basedir restriction in effect. File(https://getpocket.com/v3/oauth/request) is not within the allowed path(s): (/tmp:/in:/etc) in /in/4ddM4 on line 16 Warning: file_get_contents(https://getpocket.com/v3/oauth/request): Failed to open stream: Operation not permitted 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 8.0.13
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.3.0 - 5.3.29, 5.4.0 - 5.4.45, 7.3.32 - 7.3.33, 7.4.33
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.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.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(): open_basedir restriction in effect. File(https://getpocket.com/v3/oauth/request) is not within the allowed path(s): (/tmp:/in:/etc) in /in/4ddM4 on line 16 Warning: file_get_contents(https://getpocket.com/v3/oauth/request): failed to open stream: Operation not permitted 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.0.5, 5.1.0 - 5.1.6, 5.2.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.3.11, 4.4.0 - 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

preferences:
281.94 ms | 402 KiB | 462 Q