PHP Classes

File: test/sender.php

Recommend this page to a friend!
  Classes of Gonzalo Chumillas   HttpRequest   test/sender.php   Download  
File: test/sender.php
Role: Example script
Content type: text/plain
Description: Example script
Class: HttpRequest
Send HTTP requests to remote servers
Author: By
Last change: Update sender.php
Date: 9 years ago
Size: 718 bytes
 

Contents

Class file image Download
<?php
header
("Content-Type: text/plain; charset=UTF-8");
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;

// configuration
$config = new HttpRequestConfig();
$config->setContentTypeOption("charset", "iso-8859-1");

// sends a POST request to receiver.php and prints the contents
$req = new HttpRequestPost($config);
$req->setParam("username", "john");
$req->setParam("password", "123456");
$req->setFormParam("image", new HttpRequestFormFile("image.jpg"));
echo
$req->send("http://$_SERVER[HTTP_HOST]/" . basename(__DIR__) . "/receiver.php");