Translations:S2S ping/19/ru

From Wiki Kaminari Click

curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );

   curl_setopt( $ch, CURLOPT_HTTPHEADER, [
       'Content-Type:application/json',
       'Accept-Language:' . $_SERVER['HTTP_ACCEPT_LANGUAGE'],
       'User-Agent:' . $_SERVER['HTTP_USER_AGENT'],
       'DPR:2',
       isset($_SERVER['HTTP_REFERER']) ? 'Referer:' . $_SERVER['HTTP_REFERER'] : 'Referer:""',
   ]);
   curl_setopt( $ch, CURLOPT_HEADER, true);
   curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
   
   $response = curl_exec($ch);
   $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
   $header = substr($response, 0, $header_size);
   $body = substr($response, $header_size);
   $body = str_replace('", "', '",
"', $body); $body = str_replace('{ "', '{
"', $body); echo "<pre>1. Response length: $header_size</pre>"; echo "<pre>2. Response body: $body</pre>";