PHP code example of neoan3-apps / curl

1. Go to this page and download the library: Download neoan3-apps/curl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

neoan3-apps / curl example snippets


try{
    $comments = \Neoan3\Apps\Curl::get('https://jsonplaceholder.typicode.com/posts/1/comments');
} catch (CurlException $e){
    echo $e->getMessage();
}


/* output
* [
*   ['postId' => 1, 'name' => 'labore ...']
*   [...]
* ]
*
*/



[
    'headers' => $headers, // array
    'body' => $responseBody, // array
    'status' => $status // int (e.g.200)
];