<?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");
|