Hello, Strava!
19272, 'client_secret' => 'd6ced77a5a8bc7e4a59a592aa5d55315985dd25e', 'code' => $_GET['code'] ); // use key 'http' even if you send the request to https://... $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ($result === FALSE) { /* Handle error */ } var_dump($result); print_r("another way
"); $query = http_build_query ($data); // Create Http context details $contextData = array ( 'method' => 'POST', 'header' => "Connection: close\r\n". "Content-Length: ".strlen($query)."\r\n", 'content'=> $query ); // Create context resource for our request $context = stream_context_create (array ( 'http' => $contextData )); // Read page rendered as result of your POST request $result = file_get_contents ( 'https://www.strava.com/oauth/token', // page url false, $context); // Server response is now stored in $result variable so you can process it echo("result=".$result); print_r("
another way
"); // Create a connection $url = 'https://www.strava.com/oauth/token'; $ch = curl_init($url); // Form data string $postString = http_build_query($data, '', '&'); // Setting our options curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Get the response $response = curl_exec($ch); curl_close($ch); echo("response=".$response); header("Location: http://example.com/myOtherPage.php"); ?>



click me