15.12.22
|
Neues Mitglied
|
|
Registriert seit: May 2020
Ort: Duisburg
Beiträge: 28
|
|
Xmlrpc
Hallo ich grage mich warum ich keine Verbindung zum Server aufbauen kann...
Weis jemand Rat?
Verwendet wird https://www.mql5.com/de/articles/359 "Berechtigungsprüfung aus der Ferne"
das Entsprechende Py-Script läuft auf ein Server was antworten soll
Code:
//+------------------------------------------------------------------+
//| RemoteProtectedEABase64.mq5 |
//| Copyright 2012, Investeo.pl |
//| http://www.investeo.pl |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, Investeo.pl"
#property link "http://www.investeo.pl"
#property version "1.00"
#include <MQL5-RPC.mqh>
#include <Arrays\ArrayObj.mqh>
#include <Arrays\ArrayInt.mqh>
#include <Arrays\ArrayString.mqh>
#include <Arrays\ArrayBool.mqh>
#include <Base64.mqh>
bool license_status=false;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
/* License proxy server */
CXMLRPCServerProxy s("89.238.73.71:9099");
if(s.isConnected()==true)
{
CXMLRPCResult *result;
/* Get account data */
string User = "Test User";
string account="Test@huhu.de";
string EA="Test Abo";
printf("The name of User = %s",User);
printf("Account mail = %d",account);
/* Get remote license status */
CArrayObj* params= new CArrayObj;
CArrayString* ea = new CArrayString;
CArrayString* us = new CArrayString;
CArrayString *ac=new CArrayString;
ea.Add(EA);
us.Add(User);
ac.Add(account);
params.Add(ea); params.Add(us); params.Add(ac);
CXMLRPCQuery query("isValid",params);
result=s.execute(query);
CArrayObj *resultArray=result.getResults();
if(resultArray!=NULL && resultArray.At(0).Type()==TYPE_STRING)
{
CArrayString *stats=resultArray.At(0);
string license_encoded=stats.At(0);
printf("encoded license: %s",license_encoded);
string license_decoded;
Base64Decode(license_encoded,license_decoded);
printf("decoded license: %s",license_decoded);
CXMLRPCResult license(license_decoded);
resultArray=license.getResults();
CArrayBool *bstats=resultArray.At(0);
license_status=bstats.At(0);
}
else license_status=false;
if(license_status==true) printf("License valid.");
else printf("License invalid.");
delete params;
delete result;
}
else Print("License server not connected.");
//---
return(0);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
if(license_status==true)
{
// license valid
}
}
//+------------------------------------------------------------------+
Danke im vorraus
|