3v4l.org

run code in 300+ PHP versions simultaneously
<?php $client_id = "239"; $client_secret = "dbd8a92f126ed1a874218f17329f9432688769b2"; $access_token = "0cd76192710efdd76818141513659835b61a188e"; $redirect_uri = "http://localhost/"; $response_type = "code"; $scope = ""; $approval_prompt = ""; function authorizeUrl($clientId, $response_type, $redirect_uri, $scope, $approval_prompt){ $authorizeUrl = "https://www.strava.com/oauth/authorize?client_id=$clientId&response_type=$response_type&redirect_uri=$redirect_uri&scope=$scope&approval_prompt=$approval_prompt"; return $authorizeUrl; } function parseJason ($response){ return json_decode($response); } function tokenRequest($clientId, $clientSecret, $code){ $oauthFields = array( 'client_id' => $clientId, "client_secret" => $clientSecret, "code" => $code); var_dump($oauthFields); echo "<br>"; echo "<br>" . $oauthFields . "<br>"; print_r($oauthFields); $oauthFieldsObject = (object) $oauthFields; echo "<br>"; var_dump($oauthFieldsObject); echo "<br>"; print_r($oauthFieldsObject); echo "<br>"; $parameters = '&' . http_build_query($oauthFields); var_dump($parameters); echo "<br>". $parameters; echo "<br>"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.strava.com/oauth/token?"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); var_dump($ch); $urlResponse = curl_exec($ch); echo "<br>"; var_dump($urlResponse); $http_response = curl_getinfo($ch, CURLINFO_HTTP_CODE); $http_decoded = json_decode($http_response); echo "<br>" . $http_decoded; curl_close($ch); return json_decode($urlResponse); } echo $client_secret; echo "<br>"; $loginUrl = authorizeUrl($client_id,$response_type,$redirect_uri, $scope, $approval_prompt); echo "<a href='$loginUrl'>Click here<a>". "<br>" ; echo $loginUrl ."<br>"; echo 'https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force'."<br>"; $codeUrl = null; if (isset($_GET['code'])){ $codeUrl = $_GET['code']; } else { echo "<a href='$loginUrl'>Click here<a>". "<br>" ; } echo $codeUrl; $buildOauthTokenExchange = "https://wwww.strava.com/oauth/token"; echo "<br>"; $token = tokenRequest($client_id, $client_secret, $codeUrl); echo "<br>"; var_dump($token); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
dbd8a92f126ed1a874218f17329f9432688769b2<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt=<br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br><br>array(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br> Warning: Array to string conversion in /in/Vkga3 on line 26 <br>Array<br>Array ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>object(stdClass)#1 (3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br>stdClass Object ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>string(69) "&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2" <br>&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2<br> Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/Vkga3:42 Stack trace: #0 /in/Vkga3(78): tokenRequest('239', 'dbd8a92f126ed1a...', NULL) #1 {main} thrown in /in/Vkga3 on line 42
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.33
dbd8a92f126ed1a874218f17329f9432688769b2<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt=<br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br><br>array(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br> Notice: Array to string conversion in /in/Vkga3 on line 26 <br>Array<br>Array ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>object(stdClass)#1 (3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br>stdClass Object ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>string(69) "&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2" <br>&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2<br> Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/Vkga3:42 Stack trace: #0 /in/Vkga3(78): tokenRequest('239', 'dbd8a92f126ed1a...', NULL) #1 {main} thrown in /in/Vkga3 on line 42
Process exited with code 255.
Output for 7.3.32 - 7.3.33
dbd8a92f126ed1a874218f17329f9432688769b2<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt=<br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br><br>array(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br><br>Array<br>Array ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>object(stdClass)#1 (3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br>stdClass Object ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>string(69) "&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2" <br>&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2<br> Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/Vkga3:42 Stack trace: #0 /in/Vkga3(78): tokenRequest('239', 'dbd8a92f126ed1a...', NULL) #1 {main} thrown in /in/Vkga3 on line 42
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
dbd8a92f126ed1a874218f17329f9432688769b2<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt=<br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br><br>array(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br> Notice: Array to string conversion in /in/Vkga3 on line 26 <br>Array<br>Array ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>object(stdClass)#1 (3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br>stdClass Object ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>string(69) "&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2" <br>&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2<br> Fatal error: Call to undefined function curl_init() in /in/Vkga3 on line 42
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
dbd8a92f126ed1a874218f17329f9432688769b2<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt=<br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br><br>array(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br><br>Array<br>Array ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>object(stdClass)#1 (3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br>stdClass Object ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>string(69) "&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2" <br>&client_id=239&client_secret=dbd8a92f126ed1a874218f17329f9432688769b2<br> Fatal error: Call to undefined function curl_init() in /in/Vkga3 on line 42
Process exited with code 255.
Output for 4.4.5 - 4.4.9
dbd8a92f126ed1a874218f17329f9432688769b2<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt=<br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br><br>array(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br><br>Array<br>Array ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>object(stdClass)(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br>stdClass Object ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br> Fatal error: Call to undefined function: http_build_query() in /in/Vkga3 on line 38
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
dbd8a92f126ed1a874218f17329f9432688769b2<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt=<br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br><br>array(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br><br>Array<br>Array ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>object(stdClass)(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br>stdClass Object ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br> Fatal error: Call to undefined function: http_build_query() in /in/Vkga3 on line 38
Process exited with code 255.
Output for 4.3.0 - 4.3.1
dbd8a92f126ed1a874218f17329f9432688769b2<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt=<br>https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost&approval_prompt=force<br><a href='https://www.strava.com/oauth/authorize?client_id=239&response_type=code&redirect_uri=http://localhost/&scope=&approval_prompt='>Click here<a><br><br>array(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br><br>Array<br>Array ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br>object(stdClass)(3) { ["client_id"]=> string(3) "239" ["client_secret"]=> string(40) "dbd8a92f126ed1a874218f17329f9432688769b2" ["code"]=> NULL } <br>stdClass Object ( [client_id] => 239 [client_secret] => dbd8a92f126ed1a874218f17329f9432688769b2 [code] => ) <br> Fatal error: Call to undefined function: http_build_query() in /in/Vkga3 on line 38

preferences:
230.95 ms | 403 KiB | 313 Q