wp_remote_post help
-
Hey guys
I know that it shouldn’t be as hard as it is but I can’t get it to work somehow. I know that it may be easy to fix but I just started to learn all of this and yeah. Gotta teach myself all of that.
What I created so far is the link in order to retrieve the code.
After that I’ve got to get a request from api.twitch.tv/kraken/oauth2/token but it doesn’t work somehow. What did I do wrong?<?php $usercode = $_GET['code']; $args = array( 'method' => 'POST', 'body' => 'client_id=91th8b4i2ouxdfn660xojhu1eqfaonu&client_secret=dqhzi4h2k2rnb67bzbno9kva43uwmf9&grant_type=authorization_code&redirect_uri=https://decimo.net/token.php&code=', $usercode); $answer = wp_remote_post('https://api.twitch.tv/kraken/oauth2/token', $args); if( is_wp_error( $answer ) ) { $error_message = $answer->get_error_message(); echo "Something went wrong: $error_message"; } else { echo 'Response:<pre>'; print_r( $answer ); echo '</pre>'; } ?>
I just get a blank page. Is it maybe because I put the file @root of WP-folder?
Thanks a lot
- The topic ‘wp_remote_post help’ is closed to new replies.