You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Combining JSON with Curl is such a common task for web developers, the PHP.GT/Json library is bundled by default, which allows you to work with JSON requests and responses in a type-safe way.
Where Curl::output() returns a string representation of the HTTP response body, Curl::outputJson() returns a well-formed JsonObject that can be traversed with type safety.
Here's an example that makes a request to the https://catfact.ninja/ API, then echoes the data and it receives as a string and an int: