1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
$data = 'Variable1=exemple1&Variable2=exemple1&VariableN=exempleN';
$login = "login:password";
$header_array['Host'] = "txms.gzs.de";
$header_array['Authorization'] = "Basic ".base64_encode($login);
$header_array['Connection'] = "keep-alive";
$header_array['Content-type'] = "application/x-www-form-urlencoded\n";
$header_array['Content-Length'] = strlen($data);
$ch = curl_init();// initialize a cURL session
curl_setopt($ch, CURLOPT_URL, 'https://txms.gzs.de:51384/direct.aspx'); // set the post-tourl
curl_setopt($ch, CURLOPT_HEADER, 1);// Header control
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 1); // tell it to make a POST, nota GET
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_array);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // put the query string here
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // This allows theoutput to be set into a variable.
$sRtn = curl_exec ($ch);// execute the curl session and return the output to a variable.
curl_close($ch); // close the curlsession |
Partager