'cURL PHP API call not returning correct response

I've got a wordpress website, that features an php api call to my GitHub profile to return my public repos and render them on the site. Everything was working as it should but all of a sudden today, its not showing as expected.

Instead of looping through the results and pulling out specific parts such as the title and description and turning them into a card on the page its rendering cards with a single letter for the title and description.

Broken API Response Cards

The call to the API runs when the page is first rendered and is handled by PHP. The code is as follows.

  $username = str_replace('"', '', json_encode($config->github_username));
  $key      = str_replace('"', '', json_encode($config->github_key)); 
  $curl     = curl_init();

  curl_setopt_array($curl, array(
    CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
    CURLOPT_HTTPAUTH => '$username:$key',
    CURLOPT_URL => 'https://api.github.com/users/' . $username . '/repos',
    CURLOPT_TIMEOUT => 30,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
      'cache-control: no-cache'
    ),
  ));

  $response = curl_exec($curl);
  $response = json_decode($response, true);
  $err      = curl_error($curl);
  $err      = json_decode($err, true);
  
  curl_close($curl);

and the code to render the cards is as follows

    <?php if (empty($response)) : ?>
          <p class="is-flex-grow-2 is-size-5"><a href="https://github.com/JackRStiles" target="_blank"><i class="fab fa-github"></i> Check out my work on GitHub</a></p>
        <?php else :           
            foreach ($response as $value) : 
        ?>
          <div class="card">
            <div class="card-content">
              <h3><?= str_replace('-', ' ', $value['name']); ?></h3>
              <p><?= $value['description'] ?></p>
              <p class="tags is-hidden-touch">
                <?php foreach($value['topics'] as $val) : ?>
                  <span class="tag"><?= $val ?></span>
                <?php endforeach; ?>
              </p>
            </div>
            <footer class="card-footer">
                <a class="card-footer-item" href="<?= $value['html_url'] ?>" target="_blank"><i class="fab fa-github"></i>View Repo</a>
                <?php if ($value['homepage']) : ?>
                  <a class="card-footer-item" href="<?= $value['homepage'] ?>" target="_blank"><i class="fas fa-desktop"></i>View Demo</a>
                <?php endif; ?>
            </footer>
          </div>
        <?php 
            endforeach; 
          endif;
        ?>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source