Skip to content

Instantly share code, notes, and snippets.

@lynt-smitka
Created July 4, 2018 21:03
Show Gist options
  • Save lynt-smitka/b08dab219ea6fdc898f7e5b4e4ce516f to your computer and use it in GitHub Desktop.
Save lynt-smitka/b08dab219ea6fdc898f7e5b4e4ce516f to your computer and use it in GitHub Desktop.
//Microsoft Flow endpoint URL
$url='https://prod-44.westeurope.logic.azure.com:443/workflows/...';
//Data
$data = array(
'jmeno' => 'jmeno',
'email' => 'e-mail',
'text' => 'TEST'
);
$data_json = json_encode($data);
/* cURL Example */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_json))
);
$result = curl_exec($ch);
/* file_get_contents() Example */
$options = array(
'http' => array(
'method' => 'POST',
'content' => $data_json,
'header'=> "Content-Type: application/json\r\n" .
"Accept: application/json\r\n"
)
);
$context = stream_context_create( $options );
$result = file_get_contents( $url, false, $context );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment