PHP Curl duplicating request

Viewed 133

The Curl request is being duplicated. What I noticed is that the duplicated request is always sent without the user/pass, maybe this is a hint to what the issue is.

$user = 'xx';
$pass = 'xx';
$URL = 'xx';

$ch = curl_init()
curl_setopt($ch, CURLOPT_URL,$URL);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$user:$pass");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'env: DEV',
    'TransactionID: ' . $tr_id,
    'Content-Type:application/json'
));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$result=curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
curl_close($ch);
0 Answers
Related