1: <?php
2:
3: namespace webfilesframework\io\request;
4:
5: 6: 7: 8: 9: 10:
11: class MPostHttpRequest extends MAbstractHttpRequest
12: {
13:
14: public function __construct($url, $data = null)
15: {
16: parent::__construct($url, $data);
17: }
18:
19: public function initContext($data = null)
20: {
21:
22:
23: $http = array();
24:
25: $http['header'] = "Content-type: application/x-www-form-urlencoded\r\n";
26: $http['method'] = 'POST';
27: if (isset($data)) {
28: $http['content'] = http_build_query($data);
29: }
30:
31: $options = array(
32: 'http' => $http,
33: );
34: $this->context = stream_context_create($options);
35:
36: }
37:
38: }