You are viewing limited content. For full access, please sign in.

Question

Question

php can run workflow?

asked on February 4, 2020

Hi all,

 

Is it possible from a PHP to launch a Workflow ?

The PHP's Serveur is installed on the Workflow's Server.

 

Thanks in advance.

Regards

0 0

Replies

replied on June 8, 2020 Show version history

To follow up on this thread, my team has released a Github repository that shows how to incorporate the Workflow Web Services in different open source languages. Mainly Python, PHP, and some Javascript. Hopefully this helps someone who finds their way on this thread.

https://github.com/CabarrusCo/Laserfiche-Workflow-Web-Services-API-Examples

3 0
replied on February 5, 2020

I do think it is possible, making a POST request using the workflow REST API.

On the workflow machine visit this page to see what URI's to use and JSON body examples

http://localhost/Workflow/api/help

 

This is how Forms is able to start workflows

2 0
replied on April 21, 2020 Show version history

Late to the party, just saw this post. Here is a rough example of how to use PHP to POST to workflow web services using cURL. You may have to tweak a bit depending on your organizations setup.

 

<?php

    $handle = curl_init();

    $url = "http://WORKFLOW-LINK-HERE";

    $data = ["ParameterCollection" => [["Name" => "Message",
                                        "Value" => "Hello World!"],
                                       [
                                        "Name" => "Message Two",
                                        "Value" => "Hello World!"
                                       ]]];

    $data = json_encode($data);

    curl_setopt_array($handle,

    array(
        CURLOPT_URL => $url,
        CURLOPT_POST => true,

        CURLOPT_HTTPHEADER => array(                                                                          
            'Content-Type: application/json',                                                                                
            'Content-Length: ' . strlen($data)
        ),

        CURLOPT_POSTFIELDS => $data,
        CURLOPT_HTTPAUTH => CURLAUTH_NTLM,
        CURLOPT_USERPWD  => "DOMAIN\\ACCOUNT:XXXXX", // STORE ACCOUNT INFO SECURE, NOT PLAINTEXT, EXAMPLE ONLY
        CURLOPT_RETURNTRANSFER => true
    )

  );

    $output = curl_exec($handle);

    curl_close($handle);

    echo $output;

?>

 

Note, this example is only on a test server, when POSTing to https you might have to take extra measures with cURL.

1 0
replied on February 5, 2020

Hi Olivier,

Yes, as Chad mentioned you can do so using the Workflow Web Services API.

Please see my post here for a working example: https://answers.laserfiche.com/questions/168986/Discussion-Will-Laserfiche-ever-get-a-unified-RESTful-HTTP-API#169285

0 0
replied on February 10, 2020

Hi Chad,

 

Thanks for your help.

I tried to understand your solution but unsuccesful.

 

Do you have an exemple?

0 0
replied on February 10, 2020

Please see my other response on this thread. It contains a link to a post with a working example for Workflow Web Services attached.

2 0
replied on February 10, 2020

Yes sorry Samuel.

I downloaded your files and try to understand how to use them.

I have 2 WF (Invoking and Invoked). To my mind, I'm using the "Invoking" to invoke the "Invoked" right? But this means I need to run the Workflow "Invoking" from Workflow Designer. I don't understand how to run it from Web.

0 0
replied on February 10, 2020 Show version history

Hi Olivier

The workflow API uses something now called "REST API" which means a PHP site (or maybe in LF's case .Net site) that sits and listens for HTTP Post Requests.

This site provides the URL's which you will POST to

http://localhost/Workflow/api/help

As far as making a POST, this is something you must do using a method like posted here

https://stackoverflow.com/questions/5647461/how-do-i-send-a-post-request-with-php

1 0
replied on February 10, 2020

The "Invoking" workflow has a Web Request HTTP POST activity that sends a JSON message to the Workflow Web Services endpoint. It is meant to simulate any service that can send HTTP POST requests, since that is a standard protocol supported by most languages and applications. As Chad said there, you would send a similar HTTP POST request using PHP's method(s).

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.