I have searched and searched for a solution but cannot find it. I have a curl post request and that request returns a url. The url has a parameter in it named timestamp... It is converting the ×tamp to an xtamp as if it is encoding the × to x (multiplication). I need to prevent this from happening. I need the raw data but the Curl is returning
https://example.com?var=4134134341xtamp=1235341431341
when it should be returning
https://example.com?var=4134134341×tamp=1235341431341
I need to fix this so I get a complete url. Here is my code:
//
$data = array(
'partnerId' => '2445584555550',
'customerId' => '091874314838'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.xyz.com/connect/v2/generate");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: */*','Accept-Encoding : gzip', 'xyz-App-Key:2b152a934f248ec62584852e5997e93', 'Accept:application/json', 'xyz-App-Token:'.$tk));
$response = curl_exec($ch);
$response = json_decode($response, true);
//
echo $response;
echo "<pre>";print_r($response);
print_r($response['link']);
As you can see I have tried to echo it out in a few different ways but its still converting my ×tamp to xtamp and breaking my url. Please help and thank you very much.
curlisn't doing this, the browser is interpreting×in the URL as the HTML entity×, and rendering it as the × character.To avoid this, and also to prevent XSS exploits, always use
htmlspecialchars()when displaying text that may contain special characters.