Title: [Plugin: WP-AutoSocial] Token Problems
Last modified: August 20, 2016

---

# [Plugin: WP-AutoSocial] Token Problems

 *  Resolved Anonymous User 5746546
 * (@anonymized-5746546)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-autosocial-token-problems/)
 * Hello,
 * When I click “Get Token!” the page refreshes and says that “Facebook connected
   successfully” but it also has “Facebook: Configuration missing!”
 * There is no OAuth popup when I clicked “Get Token!” Do you know how I can fix
   this?
 * Thanks!
 * [http://wordpress.org/extend/plugins/wp-autosocial/](http://wordpress.org/extend/plugins/wp-autosocial/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter Anonymous User 5746546
 * (@anonymized-5746546)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-autosocial-token-problems/#post-2550025)
 * Something is wrong with your CURL function. This is what I tried and it works:
 * wp-autosocial.php; find “autosocial_graph” for the reference point:
 *     ```
       function curl_get_contents ($url) {
       	$curl = curl_init();
       	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
       	curl_setopt($curl, CURLOPT_URL, $url);
       	$html = curl_exec($curl);
       	curl_close($curl);
       	return $html;
       }
   
       function autosocial_graph($url, $fields = array()) {
          // function to get facebook graph api results
          //$output = file_get_contents($url);
          //$output = makeRequest($url, $fields);
          $output = curl_get_contents($url);
          return $output;
       }
       ```
   
 * But if I use makeRequest, then the call fails:
 *     ```
       function autosocial_graph($url, $fields = array()) {
          // function to get facebook graph api results
          //$output = file_get_contents($url);
          $output = makeRequest($url, $fields);
          //$output = curl_get_contents($url);
          return $output;
       }
       ```
   
 * You’re also still using file_get_contents for the Bit.ly function:
 *     ```
       function autosocial_bitly($post_ID = 0, $link = '') {
   
       ... some code here ...
   
          $bitly = json_decode(@file_get_contents('http://api.bit.ly/shorten?version=2.0.1&login='.$login.'&apiKey='.$api_key.'&longUrl='.$bl_link.'&history=1'));
       ```
   
 * I can’t figure out what’s wrong and I’d rather not use my crude hack. Could you
   take a look at it and update? Thanks!
 *  Thread Starter Anonymous User 5746546
 * (@anonymized-5746546)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-autosocial-token-problems/#post-2550027)
 * Oh, nevermind. makeRequest() is a protected method of the Facebook class.
 * I’m not very good with classes so if anyone is looking for a quick fix, here 
   it is:
 * Open wp-autosocial.php. Find `add_action('init', 'autosocial_init');`. Right 
   after that line, insert the following:
 *     ```
       function curl_get_contents ($url) {
       	$curl = curl_init();
       	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
       	curl_setopt($curl, CURLOPT_URL, $url);
       	$html = curl_exec($curl);
       	curl_close($curl);
       	return $html;
       }
       ```
   
 * Now find all instances of `file_get_contents`. Replace `file_get_contents` with`
   curl_get_contents`. There should be two that you’ll change.
 * Once you’ve done that, save, and you’re good to go.
 *  Plugin Author [Pau Capó](https://wordpress.org/support/users/paucapo/)
 * (@paucapo)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-autosocial-token-problems/#post-2550041)
 * This was something I had to do! I will improve it anyway with:
 *     ```
       function autosocial_graph($url, $fields = array()) {
          // function to get facebook graph api results
          if (function_exists('curl_version')) {
             $curl = curl_init();
             curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($curl, CURLOPT_URL, $url);
             $output = curl_exec($curl);
             curl_close($curl);
          } else
             $output = @file_get_contents($url);
          return $output;
       }
       ```
   
 * The CURL extensions is not active on all hostings, so I need to use the best 
   in any case.
    I’ll update the plugin now 😉
 * Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: WP-AutoSocial] Token Problems’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-autosocial_ffffff.svg)
 * [WP-AutoSocial](https://wordpress.org/plugins/wp-autosocial/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-autosocial/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-autosocial/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-autosocial/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-autosocial/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-autosocial/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Pau Capó](https://wordpress.org/support/users/paucapo/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-autosocial-token-problems/#post-2550041)
 * Status: resolved