How to properly use curl_init for a GET request in PHP? or Why is my curl_init GET request not workin

24 Replies, 2010 Views

For debugging, use `curl_getinfo($ch)` after execution. It gives you HTTP status, timings, etc.

Your curl_init get request is correct, but APIs sometimes redirect. Add:
```php
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
```
to handle 3xx redirects automatically.

Messages In This Thread



Users browsing this thread: 1 Guest(s)