Professional Web Applications Themes

Posting To A URL - Macromedia Flex General Discussion

I am trying to post to a URL which works fine. var url:String = "http://www.URLHere.org/" var variables:URLVariables = new URLVariables(); variables.fname="Bill"; variables.lname="Jones"; variables.checkB="value1" variables.CheckB="value2" The problem I am running into is that the page I am tring to post to has multiple check boxes with the same name. So if I use the method above, that variable only shows once when the full URL is built. [url]http://www.URLHere.org/?fname=Bill;lname=Jones;checkB=value2[/url] If I build the URL by hand like this, it checks the correct boxes based upon the value [url]http://www.URLHere.org/?fname=Bill;lname=Jones;checkB=value1;checkB=value 2[/url] Is there any way that I can add same name variables on the ...

  1. #1

    Default Posting To A URL

    I am trying to post to a URL which works fine.

    var url:String = "http://www.URLHere.org/"
    var variables:URLVariables = new URLVariables();

    variables.fname="Bill";
    variables.lname="Jones";
    variables.checkB="value1"
    variables.CheckB="value2"


    The problem I am running into is that the page I am tring to post to has
    multiple check boxes with the same name.
    So if I use the method above, that variable only shows once when the full URL
    is built.

    [url]http://www.URLHere.org/?fname=Bill;lname=Jones;checkB=value2[/url]


    If I build the URL by hand like this, it checks the correct boxes based upon
    the value
    [url]http://www.URLHere.org/?fname=Bill;lname=Jones;checkB=value1;checkB=value 2[/url]


    Is there any way that I can add same name variables on the fly?


    Thanks
    Mathias

    AwesomeDigital3 Guest

  2. #2

    Default Re: Posting To A URL

    This isn't a bug, but expected behaviour of HTTP. a POST or GET name can have one and only one value - just as a variable in a programming language.

    Try to use 'test[1]' and 'test[2]'.
    justria Guest

  3. #3

    Default Re: Posting To A URL

    I've been doing web stuff for over a decade and this is the first time I have
    seen this.

    The page was created by a PHP/perl developer and I guess he has some sort of
    loop in there, so the field names can be (and are) the same when I view the
    source of the page.

    It has never mattered before because nobody tried to post to the page from
    another source.


    If I do this (by hand)

    [url]http://www.URLHere.org/?fname=Bill;lname=Jones;checkB=value1;checkB=value 2;check[/url]
    B=value3

    The correct check boxes are checked because he is looking at the value of the
    parameter, then checking the proper box somehow in his code.

    Mathias





    AwesomeDigital2 Guest

  4. #4

    Default Re: Posting To A URL

    If you use the URL
    >>>
    [url]http://localhost:81/metaBase/trial/index.php?fname=Bill;lname=Jones;checkB=value[/url]
    1;checkB=value2;checkB=value3
    <<<

    you'll get this in PHP's $_GET superglobal:
    >>>
    Array
    (
    [fname] => Bill;lname=Jones;checkB=value1;checkB=value2;check B=value3
    )
    <<<

    Here, you perfectly can pass any string, since you pass one and only one
    string value.

    On the other hand, if you pass the values like a from would send them
    >>>
    [url]http://localhost:81/metaBase/trial/index.php?fname=Bill&lname=Jones&checkB=value[/url]
    1&checkB=value2&checkB=value3
    <<<

    you'll get this:
    >>>
    Array
    (
    [fname] => Bill
    [lname] => Jones
    [checkB] => value3
    )
    <<<

    Note, that the last occurence of a bound value is available in PHP's $_GET
    array.

    Sure, you could p the original URI and extract all parts...



    justria Guest

  5. #5

    Default Re: Posting To A URL

    Thanks Stefan,

    I think you are agreeing with me on the issue?

    The page I am posting to is not under my control, so unless I can get that
    developer to give all of the varaibles distinct names, I have no way to build
    the URL on the fly using Flex.



    AwesomeDigital2 Guest

  6. #6

    Default Re: Posting To A URL

    Yes, definitely.
    justria Guest

  7. #7

    Default Re: Posting To A URL

    [Q]The page I am posting to is not under my control, so unless I can get that
    developer to give all of the varaibles distinct names, I have no way to build
    the URL on the fly using Flex.[/Q]

    Did you tried appending the GET parameter strings to the base URI's string and
    then assign this as the request URI to your webservice object? This way, Flex
    might just pass your string straight to the server.

    In other words, I'd try to skip the 'URLVariables' strategy completely.



    justria Guest

  8. #8

    Default Re: Posting To A URL

    Sure I could hard code the string build, but I am trying to avoid that work.

    I am building the URL and parameters used on the fly as part of a testing
    script where I have a bunch of test cases in XML files.

    I open each XML file, read in the parameters and values for the test cases and
    the do the post.

    So I guess If I can not get the developer to rename, I will need to re-think
    my strategy.

    Thanks
    Mathias

    AwesomeDigital2 Guest

Similar Threads

  1. not posting
    By Nospam in forum PERL Modules
    Replies: 0
    Last Post: November 27th, 08:22 PM
  2. First posting ?
    By MaX in forum Photography
    Replies: 0
    Last Post: December 29th, 11:09 PM
  3. XML posting
    By Lyn Hartley in forum PHP Development
    Replies: 1
    Last Post: December 9th, 10:13 PM
  4. FS posting?
    By Chester in forum Macromedia Director Basics
    Replies: 0
    Last Post: November 1st, 02:29 AM
  5. Re Posting this Pls Help
    By brad anderson in forum FileMaker
    Replies: 3
    Last Post: September 16th, 10:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139