php - how can i make the server side request to get the image in the class and download/save it to my directory?

one text

i have a image class to store the google apis chart qr code and i want to get the class attribute and save/download to my directory. i am using php. and jquery for my qr code apis.

`

<img class="codeimg" height="200px" width="200px">

heres my code in jquery

document.getElementsByClassName('codeimg')[0].setAttribute('src', `https:chart.googleapis.com/chart?cht=qr&chl=${response.employee_id}&choe=UTF-8&chs=500x500`)

`

i want to get the class name of my image to store/save it to my directory `

 <?php
          $PNG_TEMP_DIR = 'temp/';
          $img = '';
          if (!file_exists($PNG_TEMP_DIR))
            mkdir($PNG_TEMP_DIR);

          $filename = $PNG_TEMP_DIR . 'test.png';

          if (isset($_POST["download"])) {
            QRcode::png($k, $filename);
          }
          ?>

`

Source