php - Why my Script google tag manager load on footer when i have declare on header

one text

I have source code like this on my php code

$packageIns = 'https://www.mywebsite.com/fromBackend/packageBox';
        $url=json_decode($this->curlPost($packageIns,$params),true);
         echo print_r($url);
         die();

but when i check on my application i got my application call url use this link

https://www.mywebsite.com/index.php/fromSuper/packageBox

so my process on curlPost add index.php why like this ? can someone help me for this issue ? i need to make my code call api https://www.mywebsite.com/fromSuper/packageBox

Source