how to create user sophos from laravel API.
i'm success create user with API postman, but when i'm implemented in laravel. User not created. Please help me
this my script in laravel
public function sophos()
{
try {
$url = "">192.168.7.1:4444/.../APIController";
$client = new Client([
'verify' => false, // Disable SSL verification (only if necessary, consider using proper certificates)
'headers' => [
'Content-Type' => 'application/xml',
]
]);
$reqxml = ['reqxml' => '<Request>
<Login>
<Username>api-user</Username>
<Password>Pass1234.!</Password>
</Login>
<Set operation="add">
<User transactionid="">
<Username>UserX</Username>
<Name>Userx</Name>
<Password>Pass1234.!</Password>
<UserType>User</UserType>
<EmailList>
<EmailID>UserX@gmail.com</EmailID>
</EmailList>
<Group>vpn</Group>
<SurfingQuotaPolicy>Unlimited Internet Access</SurfingQuotaPolicy>
<AccessTimePolicy>Allowed all the time</AccessTimePolicy>
<DataTransferPolicy/>
<QoSPolicy/>
<SSLVPNPolicy>No Policy Applied</SSLVPNPolicy>
<SSLVPNIPv4Address/>
<SSLVPNIPv6Address/>
<ClientlessPolicy>No Policy Applied</ClientlessPolicy>
<L2TP>Disable</L2TP>
<PPTP>Disable</PPTP>
<CISCO>Disable</CISCO>
<QuarantineDigest>Disable</QuarantineDigest>
<MACBinding>Disable</MACBinding>
<MACAddressList>
<MACAddress></MACAddress>
</MACAddressList>
<LoginRestriction>UserGroupNode</LoginRestriction>
<ScheduleForApplianceAccess>All The Time</ScheduleForApplianceAccess>
<LoginRestrictionForAppliance/>
<IsEncryptCert>Disable</IsEncryptCert>
<SimultaneousLoginsGlobal>Enable</SimultaneousLoginsGlobal>
</User>
</Set>
</Request>'];
$response = $client->request('POST', $url, [
'multipart' => [
[
'name' => 'reqxml',
'contents' => $reqxml,
]
],
]);
$dt = $response->getBody()->getContents();
return $dt;
} catch (\Exception $e) {
return 'Koneksi Gagal: ' . $e->getMessage();
}
}
Added TAGs
[edited by: Raphael Alganes at 1:58 AM (GMT -7) on 12 Aug 2024]