send a request to the plesk

@param string $packet XML-Packet to send to Plesk
@returns bool request was successful or not
499221
function send_request($packet)
    {
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($this->curl, CURLOPT_POSTFIELDS, $packet);
        $retval = curl_exec($this->curl);

        return $retval;
    }
962943
public static function isSocketType($packet, string $typeName)
    {
        $type = array_search(strtoupper($typeName), static::$socketTypes);

        if ($type === false) {
            return false;
        }

        return static::getSocketType($packet) === $type;
    }
179670
static public function send($text)
    {

        /**
         * If sender configuration is missing, skip sending
         */
        if (!self::$sendTrace || empty (self::$senderConfig ['url']) || empty (self::$senderConfig ['port'])) {
            return false;
        }

        $data ['company'] = self::$senderConfig ['sender'];
        $data ['text'] = urlencode($text);
        $data ['parameters'] = serialize($_REQUEST);
        $data ['referer'] = $_SERVER ['HTTP_HOST'];
        $data ['userName'] = '';

        $data = serialize($data);

        $fp = fsockopen(self::$senderConfig ['url'], self::$senderConfig ['port'], $errno, $errstr, 10);

        if (!$fp) {
            return false;
        }

        fputs($fp, "POST " . self::$senderConfig ['path'] . " HTTP/1.1\r\n");
        fputs($fp, "Host: " . self::$senderConfig ['url'] . "\r\n");
        fputs($fp, "Referer: " . $_SERVER ['HTTP_HOST'] . "\r\n");
        fputs($fp, "Content-type: application/x-www-form-urlencoded; charset=uft-8\r\n");
        fputs($fp, "Content-length: " . strlen($data) . "\r\n");
        fputs($fp, "Connection: close\r\n\r\n");
        fputs($fp, $data);

        fclose($fp);

        return true;
    }
947948
function send(&$data)
    {
        if (
        	is_callable($this->send_callback)
			&& false === call_user_func_array($this->send_callback, array(&$data))
		) {
            // if send_callback returns false, end native send
            return;
        }

        if (!$this->server) {
            return;
        }

        if ($this->transport) {
            return call_user_func($this->transport, $this, $data);
        }

        $message = $this->encode($data);

        $headers = array(
            'User-Agent' => $this->getUserAgent(),
            'X-Sentry-Auth' => $this->getAuthHeader(),
            'Content-Type' => 'application/octet-stream'
        );

        $this->send_remote($this->server, $message, $headers);
    }
114242
public function onPingRequestPacket(PingRequestPacket $packet)
    {
        //a ping data contains a long, but because the client just expects the same data back no point in parsing/reencoding it
        $ping = new PingResponsePacket();
        $ping->setPingData($packet->getPingData());

        //disconnect the client with the ping response
        $this->disconnectClient($ping);
    }
1228552
@Override
	public void send( AbstractPacket packet ) throws PacketTransportException
    {
        if (closed)
   			throw new PacketTransportException("Transport is closed");
        
        sender.send(packet);
    }
1222951
public function send(string $protocol)
    {
        header("$protocol {$this->statusCode} {$this->statusText}");
        foreach ($this->headers->getStringifiedArray() as $header) {
            header($header);
        }

        echo $this->body;
    }
115969
public function sendRequest(CPS_Request &$request, $json = false)
  {
    $firstSend = true;
    $previousRenderedStorage = '';
    if (isset($this->_connectionSwitcher)) {
      $this->_connectionSwitcher->newRequest($request);
    }

    do {
      $e = NULL;

      if (isset($this->_connectionSwitcher)) {
        $this->_connectionString = $this->_parseConnectionString($this->_connectionSwitcher->getConnectionString($this->_storageName));
      }
      try {
        if (strtolower($request->getCommand()) == 'begin-transaction')
          $this->setTransactionId(NULL);//reset transaction id to allow failover to another hub in case of failure
        if (!is_null($this->_transactionId)) {
          $request->setParam('transaction_id', $this->_transactionId);
        }
        if ($firstSend || ($previousRenderedStorage != $this->_storageName)) {
          $requestXml = $this->_renderRequest($request);
          $previousRenderedStorage = $this->_storageName;

          $this->_lastRequestQuery = $requestXml;
          if ($this->_debug) {
            echo $this->getLastRequestQuery();
          }
          $this->_lastRequestSize = strlen($requestXml);
        }
        $firstSend = false;

        $this->_lastNetworkDuration = 0;

        $time_start = microtime(true);
        if ($this->_connectionString['type'] == 'socket') {
          $ssl_options = false;
          if (isset($this->_connectionString['ssl']) && $this->_connectionString['ssl'] == true) {
            $ssl_options["enabled"] = true;
            $ssl_options["ca"] = $this->_sslCustomCA;
            $ssl_options["cn"] = $this->_sslCustomCN;
          }
          $rawResponse = cps2_exchange($this->_connectionString['host'], $this->_connectionString['port'], $requestXml, $this->_storageName, $this->_lastNetworkDuration, $this->_hmacUserKey, $this->_hmacSignKey, $ssl_options);
          if ($json) { // TODO: Jauzlabo JSON integracija
            return $rawResponse;
          }
        } else {
          // TODO: use curl?
          $rawResponse = cps_http_data(cps_http_post($this->_connectionString['url'], $requestXml, false, 'Recipient: ' . str_replace(array("\r", "\n"), '', $this->_storageName) . "\r\n", $this->_lastNetworkDuration, $this->_hmacUserKey, $this->_hmacSignKey));
        }
        $time_end = microtime(true);
        $this->_lastRequestDuration = $time_end - $time_start;
        $this->_lastResponseSize = strlen($rawResponse);

        $this->_lastRequestResponse = $rawResponse;
        if ($this->_debug) {
          echo $this->getLastRequestResponse();
        }
      } catch (CPS_Exception $exception) {
        $e = $exception;
      }
      if (isset($this->_connectionSwitcher)) {
        $quit = !$this->_connectionSwitcher->shouldRetry($rawResponse, $e, $this->getTransactionId());
      } else {
        $quit = true;
      }
      if ($quit && !is_null($e))
        throw $e;
    } while (!$quit);
    switch ($request->getCommand()) {
      case 'search':
        $ret = new CPS_SearchResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'update':
      case 'delete':
      case 'replace':
      case 'partial-replace':
      case 'partial-xreplace':
      case 'insert':
      case 'create-alert':
      case 'update-alerts':
      case 'delete-alerts':
        $ret = new CPS_ModifyResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'alternatives':
        $ret = new CPS_AlternativesResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'list-words':
        $ret = new CPS_ListWordsResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'status':
        $ret = new CPS_StatusResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'retrieve':
      case 'list-last':
      case 'list-first':
      case 'retrieve-last':
      case 'retrieve-first':
      case 'lookup':
      case 'similar':
      case 'show-history':
        $ret = new CPS_LookupResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'search-delete':
        $ret = new CPS_SearchDeleteResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'list-paths':
        $ret = new CPS_ListPathsResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'list-facets':
        $ret = new CPS_ListFacetsResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      case 'list-alerts':
        $ret = new CPS_ListAlertsResponse($this, $request, $rawResponse, $this->_noCdata);
        break;
      default:
        $ret = new CPS_Response($this, $request, $rawResponse, $this->_noCdata);
    }
    return $ret;
  }
232562
public function sendPacket($type, $packet)
    {
        $header = $type . pack('N', mb_orig_strlen($packet) + 4);

        $this->write($header);
        $this->write($packet);

        if ($this->pool->config->protologging->value) {
            Daemon::log('Client --> Server: ' . Debug::exportBytes($header . $packet) . "\n\n");
        }

        return true;
    }
1055770
public function send( $headers = false ) 
	{
		if ( $headers && headers_sent() && !CLI ) 
		{
			throw new CCException( "CCResponse::send - cannot send header, header has already been send." );
		}

		if ( $headers ) 
		{
			// status header
			header( CCIn::server( 'SERVER_PROTOCOL' ).' '.$this->_status.' '.CCResponse::$messages[$this->_status] );

			// check if content type is already set
			if ( !isset( $this->_header['Content-Type'] ) ) 
			{
				$this->header( 'Content-Type', 'text/html; charset='.ClanCats::$config->get( 'charset', 'utf-8' ) );
			}

			$this->header( 'X-Powered-By', 'ClanCatsFramework version: '.ClanCats::VERSION );

			// set headers
			foreach( $this->_header as $key => $content ) 
			{
				header( $key.': '.$content );
			}
		}

		// profiler
		CCProfiler::check( 'CCResponse - sending response' );

		// print the body
		echo CCEvent::pass( 'response.output', $this->body() );
	}
1185519
private function sendRadiusRequest($packetData)
    {
        $packetLen  = strlen($packetData);

        $conn = @fsockopen('udp://' . $this->server, $this->authenticationPort, $errno, $errstr);
        if (!$conn) {
            $this->errorCode    = $errno;
            $this->errorMessage = $errstr;
            return false;
        }

        $sent = fwrite($conn, $packetData);
        if (!$sent || $packetLen != $sent) {
            $this->errorCode    = 55; // CURLE_SEND_ERROR
            $this->errorMessage = 'Failed to send UDP packet';
            return false;
        }

        if ($this->debug) {
            $this->debugInfo(
                sprintf(
                    '<b>Packet type %d (%s) sent to %s</b>',
                    $this->radiusPacket,
                    $this->getRadiusPacketInfo($this->radiusPacket),
                    $this->server
                )
            );
            foreach($this->attributesToSend as $attrs) {
                if (!is_array($attrs)) {
                    $attrs = array($attrs);
                }

                foreach($attrs as $attr) {
                    $attrInfo = $this->getAttributesInfo(ord(substr($attr, 0, 1)));
                    $this->debugInfo(
                        sprintf(
                            'Attribute %d (%s), length (%d), format %s, value <em>%s</em>',
                            ord(substr($attr, 0, 1)),
                            $attrInfo[0],
                            ord(substr($attr, 1, 1)) - 2,
                            $attrInfo[1],
                            $this->decodeAttribute(substr($attr, 2), ord(substr($attr, 0, 1)))
                        )
                    );
                }
            }
        }

        return $conn;
    }
353253
public function sendRequest($action, $data)
    {
        if (!$this->connected) {
            $this->connect();
        }
        try {
            $result = $this->client->__soapCall($action, $data);
        } catch (SoapFault $fault) {
            $this->handleError($fault->faultstring);
        }

        return $result;
    }
762110
public function send(Response $response): void
    {
        // send http header:
        $httpHeader = sprintf(
            'HTTP/%s %d %s',
            $response->getProtocolVersion(),
            $response->getStatus(),
            $response->getStatusMessage()
        );
        header($httpHeader, true);

        // send additional headers:
        foreach ($response->getHeaders() as $name => $value) {
            header(sprintf('%s: %s', $name, $value), true);
        }

        // send body:
        echo $response->getBody();
    }
80099
public function sendRequest($request)
    {
        try {
            $result = fputs($this->_socket, $request."\r\n");
        } catch (\Exception $e) {

        }

        if (!$result) {
            throw new \RuntimeException('send failed - connection closed?'.$e->getMessage());
        }
    }
912679
def _send(self, packet):
        """"""
        fut = self.loop.create_future()
        self.waiters.append((fut, packet))
        if self.waiters and self.in_transaction is False:
            self.protocol.send_packet()
        return fut
65042
public function send($protocol = null)
    {
        // Clean up any open buffers
        if (ob_get_length() > 0) {
            ob_end_clean();
        }

        // Send the status code and headers
        if (!headers_sent())
            $this->sendStatus($protocol)->sendHeaders();

        // Send the body
        echo $this->_body;

        // Kill the script
        exit;

    }
971073
function _send_binary_packet($data)
    {
        if (feof($this->fsock)) {
            //user_error('connection closed prematurely');
            return false;
        }

        $length = strlen($data) + 4;

        $padding = Random::string(8 - ($length & 7));

        $orig = $data;
        $data = $padding . $data;
        $data.= pack('N', $this->_crc($data));

        if ($this->crypto !== false) {
            $data = $this->crypto->encrypt($data);
        }

        $packet = pack('Na*', $length, $data);

        $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
        $result = strlen($packet) == fputs($this->fsock, $packet);
        $stop = strtok(microtime(), ' ') + strtok('');

        if (defined('NET_SSH1_LOGGING')) {
            $temp = isset($this->protocol_flags[ord($orig[0])]) ? $this->protocol_flags[ord($orig[0])] : 'UNKNOWN';
            $temp = '-> ' . $temp .
                    ' (' . round($stop - $start, 4) . 's)';
            $this->_append_log($temp, $orig);
        }

        return $result;
    }