CURL_INIT GET requests can be tricky at first. Here’s a breakdown:
1. Initialize with `curl_init()` and the URL.
2. Set `CURLOPT_RETURNTRANSFER` to true so the response is saved, not echoed.
3. Execute with `curl_exec()`.
Example:
```php
$ch = curl_init("https://reqres.in/api/users?page=2");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
var_dump(json_decode($data));
```
Without RETURNTRANSFER, you’d just see the output directly—no control over it.
1. Initialize with `curl_init()` and the URL.
2. Set `CURLOPT_RETURNTRANSFER` to true so the response is saved, not echoed.
3. Execute with `curl_exec()`.
Example:
```php
$ch = curl_init("https://reqres.in/api/users?page=2");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
var_dump(json_decode($data));
```
Without RETURNTRANSFER, you’d just see the output directly—no control over it.
