Jump to content

FXSniperGuy

New Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by FXSniperGuy

  1. Thank you gizmola & mac_gyver for your time and help I was aware of the fact that i didnt get anything over, but not sure how to fix that. It works now adding the account number into the url using the $_GET. Yes i am aware of my real url, but thats only for test. Everything will be deleted from that domain when im done
  2. I also found out i forgot to add 3 lines in the MT4 code, so it looks like this now. string url = "https://johnnylai.me/license/customers.php"; string headers; char post[]; int accountNumber = (int)AccountInfoInteger(ACCOUNT_LOGIN); string postText = "account_no="+IntegerToString(accountNumber); StringToCharArray(postText, post, 0, WHOLE_ARRAY, CP_UTF8); char result[]; string resultHeaders; int response = WebRequest("POST", url, headers, 1000, post, result, resultHeaders); Print(__FUNCTION__," > Server response is ", response, " and the error is ", GetLastError()); Print(__FUNCTION__," > ", CharArrayToString(result)); return(INIT_SUCCEEDED);
  3. Now i have and is show this
  4. This is how my scripts looks like now. PHP <?php $account_no = $_GET['account_no'] ?? 0; echo ("Account No: ".$account_no."<br>"); $account = trim($account_no); echo("Trimmed account no: ".$account."<br>"); $valid_accounts = array(501412195,501412196,501412197); foreach($valid_accounts as $valid){ echo("Valid accounts: ".$valid."<br>"); } $result = in_array($account,$valid_accounts); if($result) { echo('Success'); } else { echo('Failed! - no account where found... '); } ?> And the mq4 (MT4) webrequest string url = "https://johnnylai.me/license/customers.php"; string headers; char post[]; char result[]; string resultHeaders; int response = WebRequest("POST", url, headers, 1000, post, result, resultHeaders); Print(__FUNCTION__," > Server response is ", response, " and the error is ", GetLastError()); Print(__FUNCTION__," > ", CharArrayToString(result)); return(INIT_SUCCEEDED); And the result in a browser looks like this And in MT4 expert tab So to me it looks like there's nothing in the $account_no in the second line of the php code from MT4. The account number is missing. There's something wrong in this line since it return zero. $account_no = $_GET['account_no'] ?? 0; What have i forgot ? lol
  5. if i add a "echo($account_no);" then it shows me there's "0" account numbers in that array, so the problem for me seems to be this line $account_no = $_POST['account_no'] ?? 0;
  6. Thank you both for your reply. I use this php script with a webrequest from an Expert Advisor in MT4. The webrequest looks like this : string url = "https://johnnylai.me/license/customers.php"; string headers; char post[]; char result[]; string resultHeaders; int response = WebRequest("GET", url, headers, 1000, post, result, resultHeaders); Print(__FUNCTION__," > Server response is ", response, " and the error is ", GetLastError()); Print(__FUNCTION__," > ", CharArrayToString(result)); return(INIT_SUCCEEDED); I know it has nothing to do with php, but the only reason i ask in here about that was that i use a php script to check on my server if the account was there or not and no matter what account no i use it does not see it in the php array, so i guess the problem is in the php script cause the mq4 code seems to talk to the php on my server. This is the message i get in MT4 expert tab telling me there's no account.
  7. Admin please delete the post above thx.
  8. Hello, I have this php file <?php $account_no = empty($_POST['account_no']) ? : $_POST['account_no']; $valid_accounts = array(501412195); $result = in_array((int)$account_no,$valid_accounts); if($result) { echo('Success'); } else { echo('Failed! - no account where found... '); } ?> It print out "Failed! - no account where found..." no matter what account number im using. If i change $result = in_array((int)$account_no,$valid_accounts); to $result = in_array($account_no,$valid_accounts); it print out "Success" not matter what account number i use. What is wrong with the code i have?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.