I’ve tried the code in my custom shopware 6 plugin but it says “Uncaught Error: Class ‘Webkul\Swerpsync\Controller\Api\xmlrpc_client’ not found”.
I’ve attached the full response and the code as well.
namespace Webkul\Swerpsync\Controller\Api;
require “xmlrpc.inc”;
public function testConnection($configValues)
{
file_put_contents( __DIR__ ."/test.txt", “inside test connection method\n”);
file_put_contents( __DIR__ ."/test.txt", __DIR__."/xmlrpc.inc\n");
$url = “http://192.168.10.13”;
$port = “8003”;
$db = “wc”;
$user = “admin”;
$pwd = “webkul”;
file_put_contents( __DIR__ ."/test.txt", “before response from server.\n”, FILE_APPEND);
$sock = new xmlrpc_client($url.":".$port."/xmlrpc/common");
$client = new xmlrpc_client($url.":".$port."/xmlrpc/object");
$msg = new xmlrpcmsg(‘login’);
$msg->addParam(new xmlrpcval($db, ‘string’));
$msg->addParam(new xmlrpcval($user, ‘string’));
$msg->addParam(new xmlrpcval($pwd, ‘string’));
$resp = $sock->send($msg);
file_put_contents( __DIR__ ."/test.txt", “after response from server.\n”, FILE_APPEND);
if (!$resp->faultCode()){
$userId = $resp->value()->scalarval();
}
return $configValues;