public function post_async($url, $data = array()) {
		if (filter_var($url, FILTER_VALIDATE_URL) === false) {
			throw new \Exception('Invalid URL received by http\HttpClient', 400);
		}
		$paramstr = '';
		if (!empty($data)) {
			if (is_array($data)) {
				$paramstr = $this->urlencode_array($data);
			} elseif (is_scalar($data)) {
				$paramstr = $data;
			}
		}

		$parts = parse_url($url);
		$errno = $errstr = '';
		$port = (isset($parts['port'])) ? $parts['port'] : 80;
		$timeout = 30;
		error_log('post asyncing');
		try {
			$fp = @fsockopen($parts['host'], $port, $errno, $errstr, $timeout);
		} catch (\Exception $e) {
			return false;
		}

		if (empty($fp)) {
			return false;
		}

		$out = 'POST '.$parts['path'].' HTTP/1.1'."\r\n"
			.'Host: '.$parts['host']."\r\n"
			.'Content-Type: application/x-www-form-urlencoded'."\r\n"
			.'Content-Length: '.strlen($paramstr)."\r\n"
			.'Connection: Close'."\r\n\r\n";
		if (!empty($paramstr)) {
			$out .= $paramstr;
		}

		fwrite($fp, $out);
		fclose($fp);
		return true;
	}
public function post_async($url, $data = array()) {
		if (filter_var($url, FILTER_VALIDATE_URL) === false) {
			throw new \Exception('Invalid URL received by http\HttpClient', 400);
		}
		$paramstr = '';
		if (!empty($data)) {
			if (is_array($data)) {
				$paramstr = $this->urlencode_array($data);
			} elseif (is_scalar($data)) {
				$paramstr = $data;
			}
		}

		$parts = parse_url($url);
		$errno = $errstr = '';
		$port = (isset($parts['port'])) ? $parts['port'] : 80;
		$timeout = 30;
		error_log('post asyncing');
		try {
			$fp = @fsockopen($parts['host'], $port, $errno, $errstr, $timeout);
		} catch (\Exception $e) {
			return false;
		}

		if (empty($fp)) {
			return false;
		}

		$out = 'POST '.$parts['path'].' HTTP/1.1'."\r\n"
			.'Host: '.$parts['host']."\r\n"
			.'Content-Type: application/x-www-form-urlencoded'."\r\n"
			.'Content-Length: '.strlen($paramstr)."\r\n"
			.'Connection: Close'."\r\n\r\n";
		if (!empty($paramstr)) {
			$out .= $paramstr;
		}

		fwrite($fp, $out);
		fclose($fp);
		return true;
	}
public function post_async ( $ url , $ data = array ( ) ) { if ( filter_var ( $ url , FILTER_VALIDATE_URL ) === false ) { throw new \ Exception ( 'Invalid URL received by http\HttpClient' , 400 ) ; } $ paramstr = '' ; if ( ! empty ( $ data ) ) { if ( is_array ( $ data ) ) { $ paramstr = $ this -> urlencode_array ( $ data ) ; } elseif ( is_scalar ( $ data ) ) { $ paramstr = $ data ; } } $ parts = parse_url ( $ url ) ; $ errno = $ errstr = '' ; $ port = ( isset ( $ parts [ 'port' ] ) ) ? $ parts [ 'port' ] : 80 ; $ timeout = 30 ; error_log ( 'post asyncing' ) ; try { $ fp = @ fsockopen ( $ parts [ 'host' ] , $ port , $ errno , $ errstr , $ timeout ) ; } catch ( \ Exception $ e ) { return false ; } if ( empty ( $ fp ) ) { return false ; } $ out = 'POST ' . $ parts [ 'path' ] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $ parts [ 'host' ] . "\r\n" . 'Content-Type: application/x-www-form-urlencoded' . "\r\n" . 'Content-Length: ' . strlen ( $ paramstr ) . "\r\n" . 'Connection: Close' . "\r\n\r\n" ; if ( ! empty ( $ paramstr ) ) { $ out .= $ paramstr ; } fwrite ( $ fp , $ out ) ; fclose ( $ fp ) ; return true ; }
Make an asynchronous POST request.

A fire-and-forget post function to distribute information without waiting for the recipient to respond.

@param string $url The URL to POST to.
@param array|string $data An array or string containing data to send.
@return bool Success/Failure
Make an asynchronous POST request .