Home » Php » trying to facebook access token with curl and get error “missing authorization code ”

trying to facebook access token with curl and get error “missing authorization code ”

Posted by: admin October 26, 2017 Leave a comment

Questions:

i have try to get Facebook access token with curl i have got this error
“missing authorization code ”
this is my code

$curl = "https://graph.facebook.com/oauth/access_token?client_id=xxxxx&redirect_uri=myurl/fb-tokens/&client_secret=xxxx&code=".$_GET['code']."";
        $crl = curl_init();
        $timeout = 5;
        curl_setopt ($crl, CURLOPT_URL,$curl);
        curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
        $ret = curl_exec($crl);
        curl_close($crl);
        $final_result = json_decode($ret);
        print_r($final_result); 

can any body help me ?

Answers: