Skip to content
Snippets Groups Projects
Commit 1c88f096 authored by Afnan  Ramadhan's avatar Afnan Ramadhan
Browse files

feat: add exp user (connect app to soap)

parent 3cf3b22c
No related merge requests found
......@@ -26,6 +26,7 @@ echo "<script>console.log('$id, $fullName, $email, $phone')</script>";
<!-- include js -->
<script src="../../../public/js/profile.js"></script>
<script src="../../../public/js/register.js"></script>
<script>window.onload = function() {showExp();};</script>
<title>NutriCraft</title>
</head>
<body>
......@@ -43,6 +44,7 @@ echo "<script>console.log('$id, $fullName, $email, $phone')</script>";
<div class="boxKiri">
<div class="photoContainer">
<img src=<?php echo $photo?> alt="photoProfile" class="photoProfile" id="photoProfile">
<div id="exp"></div>
<div class="editPhotoButton">
<label for="file" class="fileLabel">Choose a Photo</label>
<input type="file" name="file" id="file" class="file" accept="image/*" onchange="updatePhoto()">
......
......@@ -77,4 +77,30 @@ function showConfirmationdelete() {
console.log('cancel');
hideConfirmation();
});
}
function showExp(){
const show = "exp";
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState === 4){
let response = this.response;
// const jsonObject = JSON.parse(response);
console.log(response);
const parentElement = document.getElementById("exp");
let html = "";
html += `
<div">
<h1>EXP : ${response}</h1>
</div>
`;
parentElement.innerHTML = html;
}
};
xhttp.open('GET', `../../server/controller/auth/Profile.php?show=${show}`, true);
xhttp.send();
}
\ No newline at end of file
......@@ -111,6 +111,46 @@ if(isset($_POST['submit'])){
echo "<script>window.location.href='/?profile'</script>";
}
if(isset($_GET['show'])){
$serviceUrl = $_ENV['SOAP_URL_USER_LEVEL']."?APIkey=".$_ENV["SOAP_KEY"];
$soapRequest = '
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<getExpUser xmlns="http://Services.nutricraft.org/">
<arg0 xmlns="">1</arg0>
</getExpUser>
</Body>
</Envelope>';
$options = [
CURLOPT_URL => $serviceUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $soapRequest,
CURLOPT_HTTPHEADER => [
'Content-Type: text/xml; charset=utf-8',
'Content-Length: ' . strlen($soapRequest),
],
];
$curl = curl_init();
curl_setopt_array($curl, $options);
$response = curl_exec($curl);
curl_close($curl);
if (curl_errno($curl)) {
echo 'cURL Error: ' . curl_error($curl);
} else {
$xml = new SimpleXMLElement($response);
$returnValue = (string)$xml->xpath('//return')[0];
echo $returnValue;
}
}
// if(isset($_POST['submit'])){
// if(isset($_POST['fullName'])){
// $fullName = $_POST['fullName'];
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment