Simple loader to send request and read response from address.

Overview

Loader

Simple loader to send request and read response from address. Uses cURL extension. Composer package.

Install

composer require greezlu/ws-loader

Basic usage

Create Loader instance with request params in the constructor. Use load method to get Response object. Get data from Response object.

Example

$loader = new \WebServer\Core\Loader('https://raw.githubusercontent.com/greezlu/ws-loader/master/composer.json');
$response = $loader->load();
$response->toString();

Loader object

Main class to send response. cURL Settings.

WebServer\Core\Loader
/* Default script pause time after successful request. */
private Loader::DEFAULT_LOAD_TIMEOUT = 500000;
public Loader::__construct(
    string $address,
    string $method = 'GET',
    array $requestParams = [],
    int $requestTimeout = self::DEFAULT_LOAD_TIMEOUT
)
/* Example */
$requestParams = [
    'headers'       => ['Header-Name'   => 'Header Value'],
    'cookie'        => ['Cookie-Name'   => 'Cookie Value'],
    'curlSettings'  => ['Setting-Name'  => 'Setting Value'],
    'postParams'    => ['Param-Name'    => 'Param Value'],
    'getParams'     => ['Param-Name'    => 'Param Value']
];
/* Send request and return response object or null. */
public Loader::load(): ?Response

LoaderResponse object

Can be converted to string using magic method.

WebServer\Core\LoaderResponse
/* Get raw response as string data. */
public LoaderResponse::toString(): string
/* Attempt to decode response. Return result or empty array. */
public LoaderResponse::toArray(): array
/* Get response status code. */
public LoaderResponse::getResponseStatusCode(): array
/* Get list of response headers. */
public LoaderResponse::getResponseHeaders(): array
You might also like...
Ip2region is a offline IP location library with accuracy rate of 99.9% and 0.0x millseconds searching performance. DB file is ONLY a few megabytes with all IP address stored. binding for Java,PHP,C,Python,Nodejs,Golang,C#,lua. Binary,B-tree,Memory searching algorithm

Ip2region是什么? ip2region - 准确率99.9%的离线IP地址定位库,0.0x毫秒级查询,ip2region.db数据库只有数MB,提供了java,php,c,python,nodejs,golang,c#等查询绑定和Binary,B树,内存三种查询算法。 Ip2region特性

IPv4/IPv6 offline address database.IPv4/IPv6双栈地址离线数据库。IPv4 by 纯真网络,IPv6 by ZX Inc.

IPv4/IPv6 offline address database.IPv4/IPv6双栈地址离线数据库。IPv4 by 纯真网络,IPv6 by ZX Inc. Being updating every 5 days 每5天更新一次 IPv4 address locations by 纯真网络

This is a PHP library developed for Symfony to collect address information.

Goldbach Algorithms Address Info Getter (fondly nicknamed AIG) is a PHP library developed for Symfony to collect address information.

A WordPress plugin that displays proxied war news from the free world to Russian IP address visitors with option to block further access.
A WordPress plugin that displays proxied war news from the free world to Russian IP address visitors with option to block further access.

A WordPress plugin that displays proxied war news from the free world to Russian IP address visitors with option to block further access.

Magento 2 custom extension to add custom attributes(longitude, latitude) to customer address

Magento 2 custom extension to add custom attributes(longitude, latitude) to customer address. Then save them to quote model and copy them from quote address to order address on bakend, frontend, rest api

Pug Renderer - a (heavily based on the PhpRenderer) renderer for rendering Pug view scripts into a PSR-7 Response object

Pug Renderer This is a (heavily based on the PhpRenderer) renderer for rendering Pug view scripts into a PSR-7 Response object. It works well with Sli

Simple game server with php without socket programming. Uses the Api request post(json).

QMA server Simple game server with php without socket programming. Uses the Api request post(json). What does this code do? Register the user as a gue

[READ-ONLY] CakePHP Utility classes such as Inflector, Text, Hash, Security and Xml. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

CakePHP Utility Classes This library provides a range of utility classes that are used throughout the CakePHP framework What's in the toolbox? Hash A

Owner
null
Echo your public IP address with a very simple cURL request

Echo your public IP address with a very simple cURL request

Lucas Burlingham 13 Apr 10, 2022
SAPI request and response objects for PHP 8.1

Sapien This package provides server API (SAPI) request and response objects for PHP 8.1: Sapien\Request, composed of readonly copies of PHP supergloba

null 37 Jan 3, 2023
phalcon config loader for yaml

Phalcon Config Loarder for Yaml Loads all the yml in the directory of the app/config. Version PHP: 7.0.x, 7.1.x, 7.2.x Phalcon: 3.x Composer { "r

Toshiyuki Ienaga 2 Oct 7, 2022
Guide to setting up a lazy loader with the Lozad library in WordPress.

Install WordPress LazyLoader with LOZAD Guide to setting up a lazy loader with the Lozad library in WordPress. Installation Step 1: Refer to the foote

Peyman Naderi 4 Dec 21, 2022
Guide to setting up a lazy loader with the jQuery Lazy library in WordPress.

Run jQuery Lazy in Wordpress Guide to setting up a lazy loader with the jQuery Lazy library in WordPress. Installation Step 1: Refer to the footer.php

Peyman Naderi 5 Nov 28, 2022
Guide to setting up a lazy loader with the Lozad library in WordPress.

Install WordPress LazyLoader with LOZAD Guide to setting up a lazy loader with the Lozad library in WordPress. Installation Step 1: Refer to the foote

Peyman Naderi 7 Aug 28, 2022
Configure Magento 2 to send email using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 and many other SMTP (Simple Mail Transfer Protocol) servers

Magento 2 SMTP Extension - Gmail, G Suite, Amazon SES, Office 365, Mailgun, SendGrid, Mandrill and other SMTP servers. For Magento 2.0.x, 2.1.x, 2.2.x

MagePal :: Magento Extensions 303 Oct 7, 2022
Columnar analytics for PHP - a pure PHP library to read and write simple columnar files in a performant way.

Columnar Analytics (in pure PHP) On GitHub: https://github.com/envoymediagroup/columna About the project What does it do? This library allows you to w

Envoy Media Group 2 Sep 26, 2022
Adds a header to every response to try and twart Google's usage of your site in it's FLoC tracking method.

Laravel No FLoC This package will add the Permissions-Policy: interest-cohort=() to try and twart Google's usage of your site in it's FLoC tracking me

Jean-Philippe Murray 11 Jul 14, 2022