title: How do you retrieve data from an external api in a wordpress plugin?
body: <p>I am creating a plugin in wordpress that will create custom posts based on data that is received from an api. At first I had this code:</p>
  
  <pre><code>    $stuff_request    = 'https://thisdomain/api/stuff';
      $username = 'thisdomainuser';
      $password = 'thisdomainpassword';
  
    $headers = array( 'Authorization' =&gt; 'Basic ' . base64_encode( "$username:$password" ) );
    $stuff_response = wp_remote_get( $stuff_request, array( 'headers' =&gt; $headers ));
  
    $stuff_data = json_decode($stuff_response, true);
  </code></pre>
  
  <p>but I was receiving the error
  "expects paremter 1 to be string array given"
  which suggested to me that $stuff_response might already be getting returned in the correct format so I removed the json_decode from season data</p>
  
  <pre><code>    $stuff_data = $stuff_response;
  </code></pre>
  
  <p>but this fails to return anything at all and no error messages appear in debug. Is this a problem with how I am calling the api into the plugin or could it be an issue with the external api?</p>