<?php 
 
    namespace REQUEST_EXAMPLE; 
     
    use PECL_MIDDLEWARE_RRQUESTS; 
     
    class ExampleX{ 
     
        public static function __init(array $arr, array $postFile, array $putFile, array $postFields, 
                array $options, array $headers, array $put_data, array $query_data, 
                array $body, array $content_type, array $method, 
                array $raw_post_data, array $ssl_options, $clear_history = false) : string{ 
     
            return (string)\PECL_MIDDLEWARE_RRQUESTS\RequestsPoolX::__init( 
                array $arr, array $postFile, array $putFile, array $postFields, 
                array $options, array $headers, array $put_data, array $query_data, 
                array $body, array $content_type, array $method, 
                array $raw_post_data, array $ssl_options, $clear_history = false 
            ); 
             
        } 
    } 
     
     
     
    //arr 
     
    $arr = ['url1' => 'http://example.com/url1', 'url2' => 'http://example.com/url2']; 
     
     
     
    //postFile 
     
    $postFile = []; 
    $path_post_file = [ 
        0 => 'path/To/image_post_file.png', 
        1 => 'path/To/image2_post_file.png', 
        2 => 'path/To/image3_post_file.png', 
    ]; 
    for($i = 0; $i < sizeof($path_post_file); $i++){ 
        $type_post_file = pathinfo($path_post_file[$i], PATHINFO_EXTENSION); 
        $data_post_file = file_get_contents($path_post_file[$i]); 
        $base64_encoded_image = 'data:image/' . $type_post_file . ';base64,' . base64_encode($data_post_file); 
        array_push($postFile, $base64_encoded_image); 
    } 
     
     
     
    //putFile 
     
    $putFile = []; 
    $path_put_file = [ 
        0 => 'path/To/image_put_file.png', 
        1 => 'path/To/image2_put_file.png', 
        2 => 'path/To/image3_put_file.png', 
    ]; 
     
    for($i = 0; $i < sizeof($path_put_file); $i++){ 
        $type_put_file = pathinfo($path_put_file[$i], PATHINFO_EXTENSION); 
        $data_put_file = file_get_contents($path_put_file[$i]); 
        $base64_encoded_image = 'data:image/' . $type_put_file . ';base64,' . base64_encode($data_put_file); 
        array_push($putFile, $base64_encoded_image); 
    } 
     
     
     
    //postFields 
     
    $postFields = [ 
        'post_key' => 'post_value', 
        'post_key2' => 'post_value2', 
        'post_key3' => 'post_value3', 
    ]; 
     
     
     
    //options 
     
    $options = [ 
        'option1' => 'value1', 
        'option2' => 'value2', 
    ]; 
     
     
     
    //headers 
     
    $headers = [ 
        'header1' => 'Content-Type: application/xml+rdf', 
        'header2' => 'Content-Type: application/json', 
        'header3' => 'Location: www.example.com', 
        'header4' => 'Authorization: Basic token_no', 
        'header5' => 'Access-Control-Allow-Origin: *', 
    ]; 
     
     
     
    //put_data 
     
    $put_data = [ 
        'key1' => 'value1', 
        'key2' => 'value2', 
        'key3' => 'value3', 
    ]; 
     
     
     
    //query_data 
     
    $query_data = [ 
        'query1' => htmlspecialchars('<?xml version="1.0"?> 
                        <note 
                        xmlns="' . $_SERVER['SERVER_NAME'] . '" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="' . $_SERVER['SERVER_NAME'] . ' src/xsd/select.query.xsd"> 
                        <request_query_select> 
                        <query> 
                        <PREFIX foaf:  <http://xmlns.com/foaf/0.1/> 
                        SELECT ?name 
                        WHERE { 
                            ?person foaf:name ?name . 
                        } 
                        </query> 
                        </request_query_select> 
                        </note>', ENT_XML1, 'UTF-8'), 
        'query2' => htmlspecialchars('<?xml version="1.0"?> 
                        <note 
                        xmlns="' . $_SERVER['SERVER_NAME'] . '" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="' . $_SERVER['SERVER_NAME'] . ' src/xsd/select.query.xsd"> 
                        <request_query_select> 
                        <query> 
                        PREFIX foaf:  <http://xmlns.com/foaf/0.1/> 
                        SELECT * 
                        WHERE { 
                            ?person foaf:name ?name . 
                            ?person foaf:mbox ?email . 
                        } 
                        </query> 
                        </request_query_select> 
                        </note>', ENT_XML1, 'UTF-8'), 
        'query3' => htmlspecialchars('<?xml version="1.0"?> 
                        <note 
                        xmlns="' . $_SERVER['SERVER_NAME'] . '" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="' . $_SERVER['SERVER_NAME'] . ' src/xsd/select.query.xsd"> 
                        <request_query_select> 
                        <query> 
                        PREFIX card: <http://www.w3.org/People/Berners-Lee/card#> 
                        SELECT ?homepage 
                        FROM <http://www.w3.org/People/Berners-Lee/card> 
                        WHERE { 
                            card:i foaf:knows ?known . 
                            ?known foaf:homepage ?homepage . 
                        } 
                        </query> 
                        </request_query_select> 
                        </note>', ENT_XML1, 'UTF-8'), 
        'query4' => htmlspecialchars('<?xml version="1.0"?> 
                        <note 
                        xmlns="' . $_SERVER['SERVER_NAME'] . '" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="' . $_SERVER['SERVER_NAME'] . ' src/xsd/select.query.xsd"> 
                        <request_query_select> 
                        <query> 
                        PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
                        SELECT ?disc ?label 
                        { 
                          <http://nasa.dataincubator.org/spacecraft/1968-089A> space:discipline ?disc . 
                          ?disc rdfs:label ?label 
                        } 
                        </query> 
                        </request_query_select> 
                        </note>', ENT_XML1, 'UTF-8'), 
        'query5' => htmlspecialchars('<?xml version="1.0"?> 
                        <note 
                        xmlns="' . $_SERVER['SERVER_NAME'] . '" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="' . $_SERVER['SERVER_NAME'] . ' src/xsd/construct.query.xsd"> 
                        <request_query_construct> 
                        <query> 
                        PREFIX vCard: <http://www.w3.org/2001/vcard-rdf/3.0#> 
                        PREFIX foaf: <http://xmlns.com/foaf/0.1/> 
                        CONSTRUCT {  
                          ?X vCard:FN ?name . 
                          ?X vCard:URL ?url . 
                          ?X vCard:TITLE ?title . 
                        } 
                        FROM <http://www.w3.org/People/Berners-Lee/card> 
                        WHERE {  
                          OPTIONAL { ?X foaf:name ?name . FILTER isLiteral(?name) . } 
                          OPTIONAL { ?X foaf:homepage ?url . FILTER isURI(?url) . } 
                          OPTIONAL { ?X foaf:title ?title . FILTER isLiteral(?title) . } 
                        } 
                        </query> 
                        </request_query_construct> 
                        </note>', ENT_XML1, 'UTF-8'), 
        'query6' => htmlspecialchars('<?xml version="1.0"?> 
                        <note 
                        xmlns="' . $_SERVER['SERVER_NAME'] . '" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="' . $_SERVER['SERVER_NAME'] . ' src/xsd/ask.query.xsd"> 
                        <request_query_ask> 
                        <query> 
                        PREFIX prop: <http://dbpedia.org/property/> 
                        ASK 
                        { 
                          <http://dbpedia.org/resource/Amazon_River> prop:length ?amazon . 
                          <http://dbpedia.org/resource/Nile> prop:length ?nile . 
                          FILTER(?amazon > ?nile) . 
                        } 
                        </query> 
                        </request_query_ask> 
                        </note>', ENT_XML1, 'UTF-8'), 
        'query7' => htmlspecialchars('<?xml version="1.0"?> 
                        <note 
                        xmlns="' . $_SERVER['SERVER_NAME'] . '" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="' . $_SERVER['SERVER_NAME'] . ' src/xsd/describe.query.xsd"> 
                        <request_query_describe> 
                        <query> 
                        PREFIX foaf:  <http://xmlns.com/foaf/0.1/> 
                        DESCRIBE ?ford WHERE { 
                          ?ford foaf:name "FORD MOTOR CO" . 
                        } 
                        </query> 
                        </request_query_describe> 
                        </note>', ENT_XML1, 'UTF-8'), 
        'query8' => htmlspecialchars('<?xml version="1.0"?> 
                        <note 
                        xmlns="' . $_SERVER['SERVER_NAME'] . '" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                        xsi:schemaLocation="' . $_SERVER['SERVER_NAME'] . ' src/xsd/select.query.xsd"> 
                        <request_query_select> 
                        <query> 
                        PREFIX foaf:  <http://xmlns.com/foaf/0.1/> 
                        SELECT ?name  
                        WHERE { 
                            <http://www.rdfabout.com/rdf/usgov/congress/committees/SenateArmedServices/StrategicForces>  
                                foaf:member ?member . 
                            OPTIONAL { 
                            <http://www.rdfabout.com/rdf/usgov/congress/committees/SenateArmedServices/Personnel>  
                              foaf:member ?member2 . 
                              FILTER (?member2 = ?member) . 
                            } 
                            FILTER (!bound(?member2)) . 
                              ?member foaf:name ?name . 
                        } 
                        </query> 
                        </request_query_select> 
                        </note>', ENT_XML1, 'UTF-8'), 
    ]; 
     
     
     
    //body 
     
    $body = [ 
        'body1' => 'body of message in case working on windows, we add \r\n', 
        'body2' => 'body of message in case working on linux, we add \n', 
        'body3' => 'body of message in case working on mac, we add \r', 
    ]; 
     
     
     
    //content_type 
     
    $content_type = [ 
        'type1' => 'application/xml+rdf', 
        'type2' => 'application/json', 
    ]; 
     
     
     
    //method 
     
    $method = [ 
        'method1' => 'POST', 
        'method2' => 'GET', 
    ]; 
     
     
     
    //raw_post_data 
    $raw_post_data = [ 
        'parameter1' => 'value1', 
        'parameter2' => 'value2', 
        'parameter3' => 'value3', 
    ]; 
     
     
     
    //ssl_options 
     
    $ssl_options = [ 
        'peer_name' => 'destination-host-name.com', 
        'verify_peer' => bool, 
        'verify_peer_name' => bool, 
        'allow_self_signed' => bool, 
        'cafile' => base64_encode($ca_file_content), 
        'capath' => '/path/to/ca/file', 
        'local_cert' => '/path/to/local/cert/file', 
        'local_pk' => '/path/to/local/private/key/file', 
        'passphrase' => 'pass_phrase_of_cert_file', 
        'CN_match' => 'common_name', 
        'verify_depth' => int, 
        'ciphers' => [ 
                        'key1' => 'DEFAULT', 
                        'key2' => 'COMPLEMENTOFDEFAULT', 
                        'key3' => 'ALL', 
                        'key4' => 'COMPLEMENTOFALL', 
                        'key5' => 'HIGH', 
                        'key6' => 'MEDIUM', 
                        'key7' => 'LOW', 
                        'key8' => 'eNULL, NULL', 
                        'key9' => 'aNULL', 
                        'key10' => 'kRSA, aRSA, RSA', 
                        'key11' => 'kDHr, kDHd, kDH', 
                        'key12' => 'kDHE, kEDH, DH', 
                        'key13' => 'DHE, EDH', 
                        'key14' => 'ADH', 
                        'key15' => 'kEECDH, kECDHE, ECDH', 
                        'key16' => 'ECDHE, EECDH', 
                        'key17' => 'AECDH', 
                        'key18' => 'aDSS, DSS', 
                        'key19' => 'aDH', 
                        'key20' => 'aECDSA, ECDSA', 
                        'key21' => 'TLSv1.2, TLSv1.0, SSLv3', 
                        'key22' => 'AES128, AES256, AES', 
                        'key23' => 'AESGCM', 
                        'key24' => 'AESCCM, AESCCM8', 
                        'key25' => 'ARIA128, ARIA256, ARIA', 
                        'key26' => 'CAMELLIA128, CAMELLIA256, CAMELLIA', 
                        'key27' => 'CHACHA20', 
                        'key28' => '3DES', 
                        'key29' => 'DES', 
                        'key30' => 'RC4', 
                        'key31' => 'RC2', 
                        'key32' => 'IDEA', 
                        'key33' => 'SEED', 
                        'key34' => 'MD5', 
                        'key35' => 'SHA1, SHA', 
                        'key36' => 'SHA256, SHA384', 
                        'key37' => 'aGOST', 
                        'key38' => 'aGOST01', 
                        'key39' => 'kGOST', 
                        'key40' => 'GOST94', 
                        'key41' => 'GOST89MAC', 
                        'key42' => 'PSK', 
                        'key43' => 'kPSK, kECDHEPSK, kDHEPSK, kRSAPSK', 
                        'key44' => 'aPSK', 
                        'key45' => 'SUITEB128, SUITEB128ONLY, SUITEB192', 
                    ], 
        'capture_peer_cert' => bool, 
        'capture_peer_cert_chain' => bool, 
        'SNI_enabled' => bool, 
        'SNI_server_name' => 'host_name.com', 
        'disable_compression' => bool, 
        'peer_fingerprint' => 'md5 || SHA1', 
    ]; 
     
     
     
     
    //clear_history 
    $clear_history = FALSE; 
 
    print \REQUEST_EXAMPLE\ExampleX::__init( 
        $arr, $postFile, $putFile, $postFields, 
        $options, $headers, $put_data, $query_data, 
        $body, $content_type, $method, 
        $raw_post_data, $ssl_options, $clear_history 
    ); 
 
 |