Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
56% | Total: 469 | All time: 6,030 This week: 455 |
Version | License | PHP version | Categories | |||
http-request 1.0.0 | BSD License | 5.5 | Networking, HTTP, PHP 5 |
Description | Author | |||||||||||||||||||||||
This package can send HTTP requests to remote servers. |
|
<?php |
A library for sending HTTP requests from the server side.
Download the project:
git clone https://github.com/soloproyectos/php.httprequest
and copy the classes
folder in your preferred location (optionally, rename it). Finally, copy and paste the following PHP code:
require_once "< YOUR PREFERRED LOCATION >/classes/autoload.php";
require_once "classes/autoload.php";
use com\soloproyectos\common\http\request\HttpRequestGet;
// sends a GET request to mysite.com
$req = new HttpRequestGet();
$req->setParam("username", "john");
$req->setParam("passwrod", "smith");
echo $req->send("http://www.mysite.com");
require_once "classes/autoload.php";
use com\soloproyectos\common\http\request\HttpRequestFormFile;
use com\soloproyectos\common\http\request\HttpRequestPost;
// sends a POST request to mysite.com and attaches some files
$req = new HttpRequestPost();
$req->setParam("action", "upload-image");
$req->setFormParam("image", new HttpRequestFormFile("/path/to/image.jpg"));
echo $req->send("http://www.mysite.com");
require_once "classes/autoload.php";
use com\soloproyectos\common\http\request\HttpRequestConfig;
use com\soloproyectos\common\http\request\HttpRequestFormFile;
use com\soloproyectos\common\http\request\HttpRequestPost;
// in this case we use a configuration object
$config = new HttpRequestConfig();
$config->setOption("follow_location", true);
$config->setOption("user_agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36");
$config->setContentTypeOption("charset", "iso-8859-1");
// sends a POST request to mysite.com and attaches some files
$req = new HttpRequestPost($config);
$req->setParam("action", "upload-image");
$req->setFormParam("image", new HttpRequestFormFile("/path/to/image.jpg"));
echo $req->send("http://www.mysite.com");
Files (23) | / | classes |
File | Role | Description | ||
---|---|---|---|---|
arr (1 file, 1 directory) | ||||
http (1 file, 2 directories) | ||||
text (1 file, 3 directories) | ||||
autoload.php | Class | Class source |
Files (23) | / | classes | / | arr |
File | Role | Description | ||
---|---|---|---|---|
arguments (2 files) | ||||
arr-helper.php | Class | Class source |
Files (23) | / | classes | / | arr | / | arguments |
File | Role | Description |
---|---|---|
arr-arguments-descriptor.php | Class | Class source |
arr-arguments.php | Class | Class source |
Files (23) | / | classes | / | http |
File | Role | Description | ||
---|---|---|---|---|
exception (1 file) | ||||
request (6 files, 1 directory) | ||||
http-helper.php | Class | Class source |
Files (23) | / | classes | / | http | / | request |
File | Role | Description | ||
---|---|---|---|---|
exception (1 file) | ||||
http-request-abstract.php | Class | Class source | ||
http-request-config.php | Class | Class source | ||
http-request-form-data.php | Class | Class source | ||
http-request-form-file.php | Class | Class source | ||
http-request-get.php | Class | Class source | ||
http-request-post.php | Class | Class source |
Files (23) | / | classes | / | http | / | request | / | exception |
File | Role | Description |
---|---|---|
http-request-exception.php | Class | Class source |
Files (23) | / | classes | / | text |
File | Role | Description | ||
---|---|---|---|---|
exception (1 file) | ||||
parser (1 file, 1 directory) | ||||
tokenizer (1 file) | ||||
text-helper.php | Class | Class source |
Files (23) | / | classes | / | text | / | parser |
File | Role | Description | ||
---|---|---|---|---|
exception (1 file) | ||||
text-parser.php | Class | Class source |
Files (23) | / | classes | / | text | / | parser | / | exception |
File | Role | Description |
---|---|---|
text-parser-exception.php | Class | Class source |
Files (23) | / | test |
File | Role | Description |
---|---|---|
image.jpg | Icon | Icon image |
receiver.php | Aux. | Example script |
sender.php | Example | Example script |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | ||||||||||||||||||||||||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.