title: REST API : Fat Secret API Invalid signature: oauth_signature in PHP
body: <p>I am using Fat Secret API in my project and want to find the food names on search so I hard coded the food name say : banana and it is giving me error </p>
  
  <blockquote>
    <p>8 Invalid signature: oauth_signature 'NECnoAOp6D2qLCg7YQ84fYyJYRE='</p>
  </blockquote>
  
  <p>Below is my code </p>
  
  <pre><code>$consumer_key = "bcd69xxxxxxxxxxxxxxxxxxxxxxx52";
  $secret_key = "62fe9xxxxxxxxxxxxxxxxxxxxxxxx54d";
  
  $base = rawurlencode("GET")."&amp;";
      $base .= "http%3A%2F%2Fplatform.fatsecret.com%2Frest%2Fserver.api&amp;";
      $params = "format=json&amp;";
      $params = "method=foods.search&amp;";
      $params .= "oauth_consumer_key=$consumer_key&amp;";
      $params .= "oauth_nonce=".uniqid()."&amp;";
      $params .= "oauth_signature_method=HMAC-SHA1&amp;";
      $params .= "oauth_timestamp=".time()."&amp;";
      $params .= "oauth_version=1.0&amp;";
      $params .= "search_expression=banana";
      $params .= "oauth_callback=oob";
      $params2 = rawurlencode($params);
      $base .= $params2;
  
  //encrypt it!
  $sig= base64_encode(hash_hmac('sha1', $base, "62fe9d66898545a0b48d497a4394054d&amp;", true));
      $url = "http://platform.fatsecret.com/rest/server.api?".$params."&amp;oauth_signature=".rawurlencode($sig);
  //$food_feed = file_get_contents($url);
  list($output,$error,$info) = loadFoods($url);
  echo '&lt;pre&gt;';
  if($error == 0){
      if($info['http_code'] == '200'){
          echo $output;
          } else {
         die('Status INFO : '.$info['http_code']);
  }
  }else{
   die('Status ERROR : '.$error);
  }
  function loadFoods($url)
  {
  
          // create curl resource
          $ch = curl_init();
  
          // set url
          curl_setopt($ch, CURLOPT_URL, $url);
  
          //return the transfer as a string
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  
          // $output contains the output string
          $output = curl_exec($ch);
  
          $error = curl_error($ch);
  
          $info = curl_getinfo($ch);
          // close curl resource to free up system resources
          curl_close($ch);
  
          return array($output,$error,$info);
  
  }
  </code></pre>
  
  <p>Please Help me in this. I am new in OAuth and Fat Secret API, Please do share the necessary information if you know.</p>
  
  <p>Thanks</p>