title: Single Sign On Using cURL With Third Party API
body: <p>Alright, I have done my best to get this far using the answers here prior to posting.  I am trying to execute a single sign on (SSO) from between a Wordpress Membership Site using Membermouse and a third party content provider.  </p>
  
  <p>The third party requires that the following information be posted to a specific URL via these instructions on their API documentation:</p>
  
  <p>"Primary Login URL: <a href="https://pumpone.com/api/v1/" rel="nofollow">https://pumpone.com/api/v1/</a><strong>**</strong></p>
  
  <p>Parameters:</p>
  
  <p>api_key</p>
  
  <p>api_secret</p>
  
  <p>email</p>
  
  <p>user_id - this is the user's id in your system"</p>
  
  <p>I have have put together the following php (if you can call it that, I am very new to all coding):</p>
  
  <pre><code>&lt;?php
  
  $current_user = wp_get_current_user();
  
  $settings = array();
  $settings["api_key"] = "768749b4f42104f9d*************";
  $settings["api_secret"] = "5ade7bb55bbf4ebcc5**********";
  $settings["email"] = "$current_user_email";
  $settings["user_id"] = "$current_user_id";
  
  $url = "https://pumpone.com/api/v1/*******";
  
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_POST,true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $settings);
  
  curl_exec($ch);
  curl_close($ch);
  
  ?&gt;
  </code></pre>
  
  <p>To display the third party content on my webpage I am required to use the following:</p>
  
  <pre><code>&lt;div id="fitnessbuilder-private-label-embed"&gt;
  &lt;script&gt;
  &lt;!-- embed with your api key --&gt;
  fitnessBuilderPrivateLabel.embed_sso('768749b*************', 'SESSION_KEY');
  &lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Where the 'SESSION_KEY' must be dynamically inserted into the page.  </p>
  
  <p>I am struggling to dynamically insert the SESSION_KEY within the PHP, and to be honest, I am not sure that I am even on the right track with the PHP as I am very new to this.  Thank you in advance.</p>