Send HTTP request
-
@fxdreema but where do I use the returned value?
If I use a GET http request and send it to a php page and the return parameter == 1. What block is used to use the returned value?Let's say I want to check if the user is active. I send the GET to the php page and it will return active = 1. But then I want to use this in fxdreema, but where and how?
-
When fxdreema is making a buy or sell I have put a Send HTTPrequest in the flowchart, but it isn't working.
So, I just wonder how it should be done. If I want it to go to a web page like: www.website.com/buy.phpI did set it to the following parameters:
HTTP address: http://www.website.com/buy.php
Method: POST
Show response in message box: NoWhen it ends up on my webpage I have my code there, but it isn't loading the page as far as I can see.
Is there anything wrong in my settings here? -
I recently worked on this part of the builder and everything worked. It was with .dll before, but now they have this function WebRequest() and I moved to that function. It requires that you allow the websites that you are using in the options first. Only their main domain is enough, like http://website.com, then in the block you can use something like http://website.com/post.php. I will suggest to always use http:// or https:// if it is SSL. In both places - in the options and in the block.
Also, first try with this responce in a message box. You will see the result from the request in something like alert box, so you will know if it's working or not. Then you can disable that.
And look at the error messages. If something is not working, always... I mean ALWAYS look there first.
-
Where in the Options should that part be?
I tried to write it in "Allow WebRequest for listed URL". Is that where it's supposed to go? -
http://docs.mql4.com/common/webrequest
__To be able to use the WebRequest() function, you must add an URL to the list of allowed URLs in the "Expert Advisors" tab of the "Options" window.[/quote:32tvu44o]But this option is new and exists in the newest build
-
Hmmm, I have the latest build. But I get an error code:
WebRequest error code: 4060 -
All of a sudden it did work. Didn't do anything, but it seems to work...
-
Is there a way to add a constant to the URL?
So the code would be website.com/buy.php?invest=100 or something like that.
Is it possible to add a code like that to the url in the http request block?
Or do I have to make that one in a separate block first? -
You want to send POST and GET at the same time? Why not either POST or GET

Anyway, you can try it, it should be possible if there is no some bug. -
No. I just want to send a POST, but if it's possible to add some info in the POST url.
Maybe add what the rate is when the signal is sending or something like that. Something that is included at the end of the url that is dynamic.Let's say I get a signal to SELL. Then I would like it to send something like: http://website.com/sell.php?investment= ... te=1.24543
If it's a buy signal then maybe the url would look like this: http://website.com/buy.php?investment=150&&rate=1.24542Is it possible to add that information in the request block? Would be great.

-
I wonder why don't you try it instead of waiting for me to response
Yes, it works, you can send both, GET and POST at the same time. It's also possible to send GET from the url + GET from the parameters in the block. -
Hehe. No, I'm not waiting for response. I keep looking at the different blocks and try to figure out how to make it work, but couldn't find the answer.
Example:
If I would like to send a HTTP request to website.com/sell.php?rate=xyzWhat block should I use to find the actual rate and how can I insert it into the end of the url that is being sent?
I have tried to figure that one out by looking at different blocks and how to put the code there where I now have xyz -
There are no different blocks, there is only one block to send HTTP request.
I think you don't want to use POST, so you can just use GET. All the key-value pairs that you define in the block will be put into the web url automatically. This is GET.
-
OK, so the http address should be something like http://website.com
And the method should be set to GET
Key 1 to Market properties (and then something there to find the value or whatever I want info about)
And this will put the key 1 in the URL for me to use when it's delivered to my web site.Did I understand it correct now?
-
"Send HTTP request" knows what to do with these key-variable options.
If you choose POST, the url will remain as it is, and yes, you can put something manually in it, so on the server you will receive something in both, POST and GET.
If you choose GET, all key-value will be appended to the end of the url. You can still put key-value pairs on the url. In this case POST cannot be sent. -
Well, it seems like it was the GET part.
But where do I find the actual trade amount?
If I want to see what it is when the signal is triggered and include that in the e-mail.
What should I set the key to then? I couldn't find anything that looks like the trade amount. Or am I looking in the wrong area?
Thought it might be under the Market Properties. -
What trade amount? Do you own the server you want to request?
-
No, I just want to get the value of the currency pair where the EA is running on when the indicators is indicating buying or selling.
Isn't that possible? -
I think I found it. At least something that is close to it. I use the In Loop and then the Close Price.
I guess that's the value from the last one closed. -
You want to request a server for data, then you must know what keys and values are acceptable and in which way - POST or GET. Then, getting those values in the EA is... test this with the block called "Comment on chart".