我正在尝试使用PHP验证Qlik并没有太多运气。 但我在网上找到了这段代码片段,只是想知道如何使用CURL和PHP实现这种类型的请求。
$objHTTP = ObjCreate("Msxml2.XMLHTTP.6.0")
$objHTTP.open ("GET", "http://localhost/qrs/app/?Xrfkey=ABDHEFUELPYRVGLK", False,"my usernamer","my password")
$objHTTP.setRequestHeader("X-Qlik-Xrfkey","ABDHEFUELPYRVGLK")
$objHTTP.send()
$data = $objHTTP.responseText
这必须是GET请求。
答案 0 :(得分:0)
似乎它使用GET
basic authentication
请求。
请试试这个
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/qrs/app/?Xrfkey=ABDHEFUELPYRVGLK');
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Qlik-Xrfkey: ABDHEFUELPYRVGLK"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $result;