Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL5 (http://www.expert-advisor.com/forum/forumdisplay.php?f=221)
-   -   Xmlrpc (http://www.expert-advisor.com/forum/showthread.php?t=7278)

Aleksi 15.12.22 23:05

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


Alle Zeitangaben in WEZ +2. Es ist jetzt 09:23 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum