Download the PHP package srikant-kumar/simple-http-request without Composer
On this page you can find all versions of the php package srikant-kumar/simple-http-request. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download srikant-kumar/simple-http-request
More information about srikant-kumar/simple-http-request
Files in srikant-kumar/simple-http-request
Package simple-http-request
Short Description Use this package for making simple & complex http request
License MIT
Informations about the package simple-http-request
Simple HTTP Request : PHP
The "Simple HTTP Request" class in PHP offers a user-friendly solution for making versatile server-to-server requests without requiring intricate knowledge of the CURL library. This class streamlines the process by providing a range of convenient methods, eliminating the need for directly dealing with CURL.
With this class, developers can effortlessly initiate HTTP requests, regardless of their type, by abstracting away the complexities of CURL. Whether you need to perform GET, POST, PUT, or DELETE requests, this class has you covered. Its intuitive interface empowers developers to communicate with remote servers without delving into the intricate details of the underlying protocol.
By utilizing the "Simple HTTP Request" class, you can focus on the core functionality of your application while leaving the intricacies of HTTP communication to the class itself. This improves code readability, reduces development time, and minimizes potential errors that might arise from manually handling CURL operations.
In summary, the "Simple HTTP Request" class simplifies and enhances the process of sending HTTP requests in PHP, offering a collection of convenience methods that abstract the complexities of CURL. This class is a valuable tool for any developer aiming to streamline server-to-server communication while maintaining a clean and efficient codebase.
How to Use It ?
Method 1 : Direct Usage
- Take Pull From : https://github.com/srikant-kumar/simple-http-request
- Create Folder in your project with [FOLDER_NAME_YOU_WANT] copy all files into that.
- Follow the below code for refrence
Method 2 : Using Composer
- Run composer command in your project Directory:
composer require srikant-kumar/simple-http-request
- Include :
vendor/autoload.php
- Follow the below code for refrence
Set Request Method & Usages
Other method you can use in your request :
Request Methods | Value | Option |
---|---|---|
application/json application/x-www-form-urlencoded text/plain multipart/form-data Default : multipart/form-data |
Required | |
GET POST PUT PATCH DELETE Default : GET |
Required | |
If Request Method is Post Make an Array of post data shown as below |
Optional | |
Make an Array Of Query Pramter It will produce url with parametrs |
Optional | |
Make an Array of Request Headers shown as below |
Optional | |
Basic Auth : (String) $username & (String) $password | Optional | |
$user_agent : (String) Example : | Optional | |
$cookie_file_path : Absolute path to a txt file where cookie information will be stored. | Optional | |
Disable Cookies : No Parameter Required | Optional | |
For Enabling SSL Check | Optional | |
For Disabling SSL Check | Optional | |
$time : (Int) 10 (in second) | Optonal | |
Final Method For Running the HTTP Request | Required |
Get Response Method & Usages
Other method you can use after completion of a request : Note : Call this method after $request->run(); | Methods | Description |
---|---|---|
Get Response Body from the server | ||
Get Response Header from the server | ||
Get Response Header as Array from the server | ||
Get Content Type that you set on time of request | ||
Get Time Out that you set on time of request | ||
Get Post Fields Array that you set on time of request | ||
Get Query Parameter Array that you set on time of request | ||
Get Request URL that you set on time of request. If you will set query parameter then you will get REQUEST_URL?query_parameters |
||
Get Response HTTP Code Example : 200 , 401 , 402 , 500 etc.. | ||
$unit : (String) ms : stand for MilliSecond $unit : (String) s : stand for Second $unit : (String) m : stand for Minute $unit : (String) h : stand for Hour Default : ms |
||
Get Error If any by deafult you will get blank string |
Why Simple Http Request?
In daily development life we need to call third parties api for the projects. So every time we have to write cURL code that is hard to remember ( I don't know about others but i have problem to remeber the things 😀😀😀 ) that's why i made this package.
It is simple and easy to use.
License
Request is licensed under the MIT