cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
771
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: William Alvord on 05-12-2012 09:01:50 AM
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">I'm trying to do an http get passing a query string.  The following works from the tclsh.  I had wanted to develop the logging app first which is why I approached it this way.
source "tmpsys:lib/tcl/http.tcl"
set query [::http::formatQuery "one" "1" "two" "2"]
set Token [::http::geturl "http://1.1.1.1/logging.php" -query $query]

Then when I move it into a script on flash, this fails (actually does a post instead of a get):
package require httpios 1.0
set query [::httpios::formatQuery "one" "1" "two" "2"]
set Token [::httpios::geturl "http://1.1.1.1/logging.php" -query $query]

I'm a tcl beginner so I'm sure that there's something simple I'm overlooking but after googling and searching this forum I'm still stuck.  Any assistance is appreciated.

thanks,
will
</pre>

Subject: RE: http get with query string
Replied by: Yaw-Ming Chen on 05-12-2012 10:31:40 AM
It does do a POST
 
<dl><dt>-query <em class="m">query</dt><dd>This flag causes ::http::geturl to do a POST request that passes the query to the server. The query must be an x-url-encoding formatted query. The ::http::formatQuery procedure can be used to do the formatting.</dd><dt>-queryblocksize <em class="m">size</dt></dl>

Subject: RE: http get with query string
Replied by: William Alvord on 05-12-2012 10:36:43 AM
...so how would I go about initiating an http get request passing a query string??  I fully appreciate being told that I'm doing it the wrong way, but it would be really helpful if I knew how to do it the correct way.

Subject: RE: http get with query string
Replied by: Yaw-Ming Chen on 05-12-2012 10:57:38 AM
 
I am not a HTTP protocol expert but I think we can get answer from Tcl manul (not Tcl IVR programming guide)
In Tcl IVR API, not all commands and options are supported.Please refer to programming guide "HTTP command"
<dl><dt><a name="M13"></a>:http::geturl url ?options?</dt><dd>The ::http::geturl command is the main procedure in the package. The -query option causes a POST operation and the -validate option causes a HEAD operation; otherwise, a GET operation is performed. The ::http::geturl command returns a token value that can be used to get information about the transaction. See the STATE ARRAY and ERRORS section for details. The ::http::geturl command blocks until the operation completes, unless the -command option specifies a callback that is invoked when the HTTP transaction completes. ::http::geturl takes several options:</dd><dd></dd><dd></dd></dl>
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links