PHP code example of slice / http
1. Go to this page and download the library: Download slice/http library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
slice / http example snippets
use Slice\Http\Client;
# Initializing Client
$client = new Client();
# Set method
$client->setMethod($client::POST);
# Set URI
$client->setUri('http://localhost/ws/');
# Set GET parameters
$client->setParameterGet('fooGet','barGet');
# Set POST parameters
$client->setParameterPost(array(
'var1'=>'value1',
'var2'=>'value2',
));
# Set headers
$client->setHeaders('foo','bar');
# Set HTTP version
$client->setHTTPVersion($client::HTTP_0);
# Performing request
$response = $client->request();