title: PHP CURL having 400 while it works
body: <p>While checking the URL: <a href="https://i2.wp.com/jarek-kefir.org/wp-content/uploads/2019/04/po%C5%BCar-katedry-notre-dame.jpg?ssl=1" rel="nofollow noreferrer">https://i2.wp.com/jarek-kefir.org/wp-content/uploads/2019/04/pożar-katedry-notre-dame.jpg?ssl=1</a></p>
  
  <p>I have result status code <code>400</code>...</p>
  
  <p>This is my function:</p>
  
  <pre><code>public function callAPI($url)
  {
      $curl = curl_init();
      error_log('Checking url: ' . $url);
  
      // OPTIONS:
      curl_setopt($curl, CURLOPT_URL, $url);
      curl_setopt($curl, CURLOPT_HTTPHEADER, array(
          //'APIKEY: 111111111111111111111',
          'Content-Type: application/json',
      ));
  
      curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
      curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  
      // EXECUTE:
  
      $result = utf8_decode(curl_exec($curl));
      $result = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $result);
  
      if (!$result) {
          error_log('Connection Failure ' . $result . ' for url: ' . $url);
      }
      // Check if any error occurred
      $error_msg = '';
      $error_number = curl_errno($curl);
      $error_info = curl_error($curl);
  
      $info = curl_getinfo($curl);
      $httpCode = $info['http_code'];
      $request_ok = $httpCode == 200 || $httpCode == 201 || $httpCode == 204;
      error_log('$httpCode: ' . $httpCode);
      if (!$request_ok) {
          $info = curl_error($curl);
          $error_msg = $info ? $info : "Http code: " . $httpCode;
          error_log('Error while checking url: ' . $url . ' : ' . $error_msg);
      }
  
      curl_close($curl);
      return $error_msg;
  }
  </code></pre>
  
  <p>but when I check it manually or even by curl from command line it works fine.
  Probably I miss some configuration for curl here..</p>