fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Send HTTP request

    Questions & Answers
    5
    35
    18984
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      coverman @fxDreema last edited by

      @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?

      1 Reply Last reply Reply Quote 0
      • C
        coverman last edited by

        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.php

        I did set it to the following parameters:
        HTTP address: http://www.website.com/buy.php
        Method: POST
        Show response in message box: No

        When 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?

        1 Reply Last reply Reply Quote -1
        • fxDreema
          fxDreema last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • C
            coverman last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • fxDreema
              fxDreema last edited by

              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

              1 Reply Last reply Reply Quote 0
              • C
                coverman last edited by

                Hmmm, I have the latest build. But I get an error code:
                WebRequest error code: 4060

                1 Reply Last reply Reply Quote 0
                • C
                  coverman last edited by

                  All of a sudden it did work. Didn't do anything, but it seems to work...

                  1 Reply Last reply Reply Quote 0
                  • C
                    coverman last edited by

                    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?

                    1 Reply Last reply Reply Quote 0
                    • fxDreema
                      fxDreema last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • C
                        coverman last edited by

                        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.24542

                        Is it possible to add that information in the request block? Would be great. 🙂

                        1 Reply Last reply Reply Quote 0
                        • fxDreema
                          fxDreema last edited by

                          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.

                          1 Reply Last reply Reply Quote 0
                          • C
                            coverman last edited by

                            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=xyz

                            What 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

                            1 Reply Last reply Reply Quote 0
                            • fxDreema
                              fxDreema last edited by

                              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.

                              1 Reply Last reply Reply Quote 0
                              • C
                                coverman last edited by

                                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?

                                1 Reply Last reply Reply Quote 0
                                • fxDreema
                                  fxDreema last edited by

                                  "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.

                                  1 Reply Last reply Reply Quote 0
                                  • C
                                    coverman last edited by

                                    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.

                                    1 Reply Last reply Reply Quote 0
                                    • fxDreema
                                      fxDreema last edited by

                                      What trade amount? Do you own the server you want to request?

                                      1 Reply Last reply Reply Quote 0
                                      • C
                                        coverman last edited by

                                        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?

                                        1 Reply Last reply Reply Quote 0
                                        • C
                                          coverman last edited by

                                          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.

                                          1 Reply Last reply Reply Quote 0
                                          • fxDreema
                                            fxDreema last edited by

                                            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".

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post

                                            Online Users

                                            S
                                            A
                                            B
                                            A
                                            J
                                            D

                                            15
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors