Issues (55)

exemplo/exemplosRestaurantes/get-restaurants.php (1 issue)

Labels
Severity
1
<?php
2
 
3
$curl = curl_init();
4
 
5
curl_setopt_array($curl, array(
6
  CURLOPT_URL => 'https://localhost/v1/restaurants',
7
  CURLOPT_RETURNTRANSFER => true,
8
  CURLOPT_ENCODING => '',
9
  CURLOPT_MAXREDIRS => 10,
10
  CURLOPT_TIMEOUT => 0,
11
  CURLOPT_FOLLOWLOCATION => true,
12
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
  CURLOPT_CUSTOMREQUEST => 'GET',
14
  CURLOPT_HTTPHEADER => array(
15
    'page: 1'
16
  ),
17
));
18
 
19
$response = curl_exec($curl);
20
$err     = curl_errno($curl);
21
$errmsg  = curl_error($curl) ;
22
23
curl_close($curl);
24
25
echo (!empty($err)) ? $errmsg : $response;
0 ignored issues
show
Are you sure ! empty($err) ? $errmsg : $response of type string|true can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
echo /** @scrutinizer ignore-type */ (!empty($err)) ? $errmsg : $response;
Loading history...
26