- Php
- Features
- Autoload
- Class Reflection
- Magic Methods
- Exceptions
- Late Static Binding
- Type Hinting
- SPL
- PHPUNIT
- PHAR
- Composer
- Guzzle
- Carbon
- Faker
- Math
- Requests ♣
- Design Patterns
- Singleton Pattern
- Observer Pattern
- Strategy Pattern
- Registry
- Symfony
- Routes
- Annotations
- Flex
- Controllers
- Doctrine
- Templating
- Versions
- Php7.4
- Php8.0
- Security
- Filter Input
- Remote Code Injection
- Sql Injection
- Session Fixation
- File Uploads
- Cross Site Scripting
- Spoofed Forms
- CSRF
- Session Hijacking
- Modern Php
- Composer
- Slim Framework
- Autoloader
- Package
- Releases
- Generators
- Dependency Injection
- Middleware
- Create Framework
- App
- Http Foundation
- Front Controller
- Routing
- Render Controller
- Resolver
- SoC
- Frameworks
- Symfony V5
- Laravel V8
- Laminas V3
- Codeigniter V4
Requests
Requests is a HTTP library written in PHP, for human beings.
/**
* Requests library
*
* It is roughly based on the API from the excellent ...
* Requests Python library.
*
* Other HTTP libraries optimize for the library developer’s time.
* Requests optimizes for your time.
*
* composer require rmccue/requests
*/
require_once __DIR__ . '/vendor/autoload.php';
use WpOrg\Requests\Requests;
$url = 'http://httpbin.org/get';
$headers = ['Accept' => 'Application/json'];
$options = ['auth' => ['user', 'pass']];
$request = Requests::get($url, $headers, $options);
echo $request->status_code; // 200
echo $request->headers['content-type'];
// application/json; charset=utf-8
$body = json_decode($request->body);
echo $body->origin; // 188.26.232.235
echo $body->headers->Host; // httpbin.org
Last update: 61 days ago