How to properly use curl_init for a GET request in PHP? or What's the correct way to handle a curl_in

18 Replies, 1490 Views

Yo, make sure you’re not missing SSL verification. Some servers freak out if you don’t handle it properly. Add these options:

```php
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
```

But be careful—this is insecure for production. Better to fix the certs properly.

Also, Postman is a great tool to test APIs before coding.

Messages In This Thread



Users browsing this thread: 1 Guest(s)