PHP WebSocket2 Library
PHP5 Library for browsing web
Main Page
Data Structures
Examples
http_post_parameters.php
This is an example of how to send POST request with parameters.
<?php
require
'../websock2.php'
;
//Create file socket
$socket =
new
FileSocket
;
//Create new request
$request =
WebRequest::createFromUrl
(
'http://httpbin.org/post'
);
//Change method to POST
//If you comment out this line, request will be sent with GET method
$request->setMethod(
WebRequest::METHOD_POST
);
//Get parameter manager
$params = $request->getParamManager();
//Add some parameters
$params[
'test_param'
] = 123;
$params[
'test_array'
] = [
'a'
,
'b'
,
'c'
];
//Run request and echo response body contents (without headers)
echo $socket->sendRequest($request)->getBody();
Generated on Sun Jan 25 2015 20:05:38 for PHP WebSocket2 Library by
1.8.9.1