Recommend this page to a friend! |
Download .zip |
Info | Example | View files (23) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2015-01-10 (1 year ago) | Not enough user ratings | Total: 448 | All time: 5,886 This week: 1,099 |
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. |
|
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 | / | 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 | / | classes | / | arr | / | arguments |
File | Role | Description |
---|---|---|
arr-arguments-descriptor.php | Class | Class source |
arr-arguments.php | Class | Class source |
Files | / | classes | / | http |
File | Role | Description | ||
---|---|---|---|---|
exception (1 file) | ||||
request (6 files, 1 directory) | ||||
http-helper.php | Class | Class source |
Files | / | 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 | / | classes | / | http | / | request | / | exception |
File | Role | Description |
---|---|---|
http-request-exception.php | Class | Class source |
Files | / | classes | / | text |
File | Role | Description | ||
---|---|---|---|---|
exception (1 file) | ||||
parser (1 file, 1 directory) | ||||
tokenizer (1 file) | ||||
text-helper.php | Class | Class source |
Files | / | classes | / | text | / | parser |
File | Role | Description | ||
---|---|---|---|---|
exception (1 file) | ||||
text-parser.php | Class | Class source |
Files | / | classes | / | text | / | parser | / | exception |
File | Role | Description |
---|---|---|
text-parser-exception.php | Class | Class source |
Files | / | test |
File | Role | Description |
---|---|---|
image.jpg | Icon | Icon image |
receiver.php | Aux. | Example script |
sender.php | Example | Example script |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.