Move
echo $response;
inside the
if
branch:
if(curl_getinfo($curl, CURLINFO_HTTP_CODE) != 200){
echo $response;
echo "Something went wrong! Try again";
}
else {
header("Location: cart.php");
}
If you're redirecting, virtually nobody would see the body of the response, so there's no point echoing it in the
else
branch.