Lines Matching defs:data
61 // what we use as boundary on multipart/form-data posts
107 * @param array $data Associative array of parameters
113 public function dget($url, $data, $sloppy304 = false)
120 $url .= $this->postEncode($data);
130 * @param array $data Associative array of parameters
134 public function post($url, $data)
136 if (!$this->sendRequest($url, $data, 'POST')) return false;
147 * Post data should be passed as associative array. When passed as string it will be
151 * @param mixed $data - the post data either as array or raw data
158 public function sendRequest($url, $data = '', $method = 'GET')
166 // save unencoded data for recursive call
167 $unencodedData = $data;
218 if (is_array($data)) {
222 if ($headers['Content-Type'] == 'multipart/form-data') {
223 $headers['Content-Type'] = 'multipart/form-data; boundary=' . $this->boundary;
224 $data = $this->postMultipartEncode($data);
227 $data = $this->postEncode($data);
231 $data = ''; //no data allowed on GET requests
234 $contentlength = strlen($data);
305 $request .= $data;
574 * Safely write data to a socket
577 * @param string $data The data to write
583 protected function sendData($socket, $data, $message)
586 $towrite = strlen($data);
607 $nbytes = fwrite($socket, substr($data, $written, 4096));
615 * Safely read data from a socket
836 * Encode data for posting
838 * @param array $data
843 protected function postEncode($data)
845 return http_build_query($data, '', '&');
849 * Encode data for posting using multipart encoding
852 * @param array $data
857 protected function postMultipartEncode($data)
861 foreach ($data as $key => $val) {
864 $out .= 'Content-Disposition: form-data; name="' . urlencode($key) . '"' . HTTP_NL;
869 $out .= 'Content-Disposition: form-data; name="' . urlencode($key) . '"';