Skip to content

PHP client

Akram El Assas edited this page Oct 16, 2024 · 1 revision

Here is a sample PHP client:

<!DOCTYPE html>
<html>
    <body>
        <center>
            <h2>
                <?php

                    $WorkflowId=153;

                    $curl = curl_init();

                    curl_setopt_array($curl, array(
                    CURLOPT_URL => "http://localhost:8000/api/v1/start?w=".$WorkflowId,
                    CURLOPT_RETURNTRANSFER => true,
                    CURLOPT_ENCODING => "",
                    CURLOPT_MAXREDIRS => 10,
                    CURLOPT_TIMEOUT => 0,
                    CURLOPT_FOLLOWLOCATION => true,
                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                    CURLOPT_CUSTOMREQUEST => "POST",
                    CURLOPT_HTTPHEADER => array(
                        "Content-Type: application/json",
                        "Content-Length: 0",
                        "Authorization: Basic ".base64_encode("admin".":".md5("wexflow2018"))
                    ),
                    ));

                    $response = curl_exec($curl);
                    curl_close($curl);
                    // $response is actually the executed workflow Instance Id i.e. a GUID
                    echo $response;

                    ?>
            </h2>
        </center>
    </body>
</html>
Clone this wiki locally