Announcement

Collapse
No announcement yet.

Server Exchange

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    Howdy, Mike!

    I assume David is talking about using TCPIP to return the results of the database search - similar result to what Stuart has done with IWinHttpRequest ? I don't know how TCPIP would be used to run the PHP file. More excitement to come!

    Comment


    • #62
      Originally posted by Mike Doty View Post
      WampServer runs on Windows and installs all the needed database tools?
      https://sourceforge.net/projects/wampserver/

      I am reading about it and wondered if your link is better than this one? https://www.wampserver.com/en/downlo...server-64bits/

      I am learning a lot this week.
      Both links are for the same package, so if you just want the installation, either one is the same.
      The wampserver.com website has a few other pages.

      Source Forge:
      Wampserver 3.2.6 full install
      -- Wampserver 3.2.6 64 bit x64
      Apache 2.4.51 - PHP 5.6.40/7.4.26/8.0.13/8.1.0 - MySQL 5.7.36|8.0.27 - MariaDB 10.5.13|10.6.5
      -- Wampserver 3.2.6 32 bit x86
      Apache 2.4.51 - PHP 5.6.40/7.4.26/8.0.13/8.1.0 - MySQL 5.7.36 - MariaDB 10.5.13|10.6.5
      PhpMyAdmin 5.1.1 & 4.9.7 - Adminer 4.8.1 - PhpSysInfo 3.3.4
      Option : PHP 7.0.33/7.1.33/7.2.34/7.3.30​

      wampserver.com:
      Wampserver 3.2.6 64 bit x64 – Apache 2.4.51 – PHP 5.6.40/7.4.26/8.0.13/8.1.0 – MySQL 5.7.36|8.0.27 – MariaDB 10.5.13|10.6.5PhpMyAdmin 4.9.7 & 5.1.1 – Adminer 4.8.1 – PhpSysInfo 3.3.4 – En Option : PHP 7.0.33/7.1.33/7.2.34/7.3.30

      Comment


      • #63
        Originally posted by Gary Beene View Post
        [B]t ? I don't know how TCPIP would be used to run the PHP file. More excitement to come!
        You'd have to emulate everything the HTTP server currently does - and have an appropriate port open on the web server. Possible if you are doing your own hosting but I doubt very much that your current hosting organisation would open other ports for you and redirect them to your area of the server.

        Comment


        • #64
          Originally posted by Gary Beene View Post
          Howdy, David!

          That database scenario as described in Test Forums is the task of interest. What Stuart posted in Working with Objects appears to do just what I am looking to do and I expect to use his suggestion.
          Having difficulty in identifying what specific posts you are talking about. Your links are to the whole forums.

          Comment


          • #65
            Howdy, Stuart!

            Something weird is going on!

            I'd swear I typed in # 45 and # 49 (no spaces) into that post of mine. How it got translated into "Test Forums" and "Working with Object" is beyond me!

            I'll try it again ...

            That database scenario as described in Test Forums is the task of interest. What Stuart posted in Working with Objects appears to do just what I am looking to do and I expect to use his suggestion.​

            Look! It did it again! Where I typed in # 45 and # 49 with no spaces were translated by the forum to forum titles?

            Comment


            • #66
              What database scenario in Test Forums?
              What post in Working with Objects? There are many pages.

              Posts 45 and 49 in this thread. I was confused. See above post.
              Yes, can get weird things using # followed by a number.

              Glad you got something working!

              Comment


              • #67
                Click on post number in post you want to refer to, follow popup instructions.

                (you'll note that numbers like 45 and 49 aren't in the generated link)

                Cheers,
                Dale

                Comment


                • #68
                  Great tip, Dale!

                  Gary,
                  wsrequest = "select rowid from parts where rowid % 1000 = 0 order by rowid;"

                  This is a valid sqlite statement where % works like MOD.
                  I have been trying to escape the character and my virus checker also goes crazy with it.


                  Comment


                  • #69
                    Howdy, Mike!

                    Yes, I don't know why I don't embrace sqlite. It really does offer useful capabilities.

                    Comment


                    • #70
                      This will run a PHP file on the server without doing anything with the output of the PHP file (i.e., not open a browser as does ShellExecute)

                      Code:
                      wget http://myserver.com/lookup.php?param1=rabbit -q
                      But one-line as it is, it is still not a "satisfying" solution.

                      Comment


                      • #71
                        I shouldn't have shown the whole statement.
                        My point is % causes a failure after the send.
                        This might not be the case with POST.
                        pHttpReq.Send
                        ? pHttpReq.StatusText,,"Bad request

                        Comment


                        • #72
                          if you are using Stuat's Post function
                          you are specifying that the content is urlencoded.
                          pHttpReq.SetRequestHeader "Content-Type","application/x-www-form-urlencoded"

                          wsrequest = "select rowid from parts where rowid % 1000 = 0 order by rowid;"
                          You should URL encode your request
                          wsrequest = "select%20rowid%20from%20parts%20where%20rowid%20%25%201000%20%3D%200%20order%20by%20rowid%3B"

                          Probably also use UTF8

                          if you are using direct GET request you also need to urlencode

                          Comment


                          • #73
                            No. I'm using GET.

                            Comment


                            • #74
                              I edited my post
                              GET also needs URLEncode since the request is sent directly with the URL

                              Comment


                              • #75
                                cgiparam in Pbcgi.inc is convert % after the first rowid to this:
                                svalue = cgiParam(sBuffer,"valuel")
                                select rowid from parts where rowid00=0 order by rowid;

                                Comment


                                • #76
                                  I don't have PBCGI.INC
                                  Edit:
                                  Ok I found it in PBCC60\samples\Internet\CGI\


                                  But if you are using WinHttpRequest to send the request, it expect the url to be valid. % is a reserved character for URL's generally used for encoding.
                                  Reserved Characters ! * ' ( ) ; : @ & = + $ , / ? % # [ ]

                                  on the receiving end if it's a CGI you wrote, it may need to URL Decode before using the request.

                                  Comment


                                  • #77
                                    I'll see if there is a decode.
                                    I did a kludge that worked.
                                    LOCAL position AS LONG
                                    position = INSTR(UCASE$(s),"XXX ")
                                    IF position THEN REPLACE "MOD" WITH "%" IN s​

                                    I better quit as this may be getting off topic.
                                    Not sure if Ill break something by adding to list.

                                    FUNCTION DecodeCGI (BYVAL sInput AS STRING) AS STRING

                                    Thanks, Rod!

                                    Comment


                                    • #78
                                      Originally posted by Gary Beene View Post
                                      Howdy, Stuart!

                                      Something weird is going on!

                                      I'd swear I typed in # 45 and # 49 (no spaces) into that post of mine. How it got translated into "Test Forums" and "Working with Object" is beyond me!
                                      The forum has been automagically converting hash signs to links for a while now ( a bug in the last update). . That's why I've started typing Post 45, not Post "hash sign" 45. If you mess up code tags it does the same thing with hash-COMPILE etc.


                                      Comment


                                      • #79
                                        Originally posted by Gary Beene View Post
                                        This will run a PHP file on the server without doing anything with the output of the PHP file (i.e., not open a browser as does ShellExecute)

                                        Code:
                                        wget http://myserver.com/lookup.php?param1=rabbit -q
                                        But one-line as it is, it is still not a "satisfying" solution.
                                        But only if you have downloaded the wget utility and placed it in the same directoy as your executable or in a directory in your path. :

                                        "GNU Wget is a free network utility to retrieve files from the World Wide Web using HTTP and FTP"

                                        And what do you mean "without doing anything with the output?
                                        Obviously it has to output it either to StdOut or to a file. IOW, it just does what the previously posted simple GET and POST functions do - but they don't have any external dependencies.

                                        Comment


                                        • #80
                                          Originally posted by Rod Macia View Post
                                          if you are using Stuat's Post function
                                          ...
                                          You should URL encode your request
                                          wsrequest = "select%20rowid%20from%20parts%20where%20rowid%20%25%201000%20%3D%200%20order%20by%20rowid%3B"
                                          ...
                                          Probably also use UTF8
                                          ...
                                          Originally posted by Mike Doty View Post
                                          I shouldn't have shown the whole statement.
                                          My point is % causes a failure after the send.
                                          This might not be the case with POST.
                                          pHttpReq.Send
                                          ? pHttpReq.StatusText,,"Bad request
                                          With POST, you can send almost any text with "Content-Type","application/x-www-form-urlencoded"
                                          The only exception is you need to URLEncode any "&" in your data as %26 since that is a parameter delimiter

                                          Some examples to make this clear using Post 36 PB source
                                          and this PHP file
                                          Code:
                                          <?php
                                          $key = "";
                                          $key2 = "";
                                          if (isset($_POST['data'])) {
                                          $key = $_POST['data'];
                                          }
                                          if (isset($_POST['data2'])) {
                                          $key2 = $_POST['data2'];
                                          }
                                          echo "Data:".$key."\r\n"."DAta2:".$key2;
                                          ?>​
                                          and this line
                                          Code:
                                          wsRequest = "data=abc & ; , /  &data2 === é" & CHR$$(333) & " : @ & = + % $ - _ . ! ~ * ' ( ) #"
                                          ​
                                          we get
                                          Data:abc (& truncates)
                                          DAta2:​ (no "=" directly after &Data2)

                                          WIth
                                          Code:
                                          wsRequest = "data=abc %26 ; , /  &data2=== é" & CHR$$(333) & " : @ & = + % $ - _ . ! ~ * ' ( ) #"
                                          we get
                                          Data:abc & ; , /
                                          DAta2:== éō : @ ​ (last "&" truncates)

                                          With
                                          Code:
                                          wsRequest = "data=abc %26 ; , / %26data2=== é" & CHR$$(333) & " : @ & = + % $ - _ . ! ~ * ' ( ) #"
                                          we get

                                          Data:abc & ; , / &data2=== éō : @ ( %26 doesn't create a second parameter but last "&" still truncates)
                                          DAta2:​

                                          Note that WSTRING and CHR$$(333) doesn't cause a problem! It correctly give us "ō"

                                          Comment

                                          Working...
                                          X