Skip to content

Commit d420afa

Browse files
author
David Baum
committed
connector: use curl to get returncode from generator
1 parent a9f60bf commit d420afa

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

ui/generator-connector.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,13 @@
7070
'rd.method_type_mode' => $_REQUEST['rd_method_type_mode']
7171
);
7272

73-
// use key 'http' even if you send the request to https://..
74-
$options = array(
75-
'http' => array(
76-
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
77-
'method' => 'POST',
78-
'content' => http_build_query($payload)
79-
)
80-
);
81-
$context = stream_context_create($options);
82-
$result = file_get_contents($url, false, $context);
83-
84-
// false, because we receive redirect
85-
if ($result === FALSE) {
73+
$curl = curl_init();
74+
curl_setopt($curl, CURLOPT_URL, $url);
75+
curl_setopt($curl, CURLOPT_POST, 1);
76+
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($payload));
77+
$return = curl_exec($curl);
78+
curl_close ($curl);
79+
if ($return == "OK") {
8680
header("Location: index.php?aframe=true&model=$model&setup=web_a-frame/default&srcDir=data-gen");
8781
die();
8882
}

0 commit comments

Comments
 (0)