Solved

Split content of return post data, possibly using a dictionary object

Posted on 2012-04-04
2
302 Views
Last Modified: 2012-04-05
I am using ServerXMLHTTP to post to a server and the return post data coming back to me needs to be parsed in to a format I can use. The data is coming back to me like the below :

POST.VALIDATION=ACK&FRONTEND.REDIRECT_URL=https%3A%2F%2Ftest.ctpe.net%2Ffrontend%2FstartFrontend.prc%3Bjsessionid%gg.sbg-vm-fe01&P3.VALIDATION=ACK 

Open in new window


What I want to do is split name / value pairs and, ideally, be able to reference the name value, i.e. be able to test if there is a dictionary item called POST.VALIDATION and what the value is.
0
Comment
Question by:AbeSpain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 37811711
there's no straightforward way to do this, you'll need to split each key/value string, then split each key and value into seperate values.

I'm assuming the "splitter" is the "&" symbol, correct? if so, the code would be:

   data = "POST.VALIDATION=ACK&FRONTEND.REDIRECT_URL=https%3A%2F%2Ftest.ctpe.net%2Ffrontend%2FstartFrontend.prc%3Bjsessionid%gg.sbg-vm-fe01&P3.VALIDATION=ACK"

   Set dictData = Server.CreateObject("Scripting.Dictionary")
   arrData = Split( data, "&" )

   for each keyValuePair in arrData
      arrKeyValuePair = Split( keyValuePair, "=" )      '-- the splitter is now the equals sign
      dictData.Add arrKeyValuePair( 0 ), arrKeyValuePair( 1 )
   next

Open in new window


now all the data is in the dictData dictionary object. For more info, see  http://www.w3schools.com/asp/asp_ref_dictionary.asp

edit: one typo in the code snippet I gave you, now fixed
0
 

Author Comment

by:AbeSpain
ID: 37812295
That's similar to how I did it in the end, I appreciate the reply :)
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBSCRIPT string remove all characters to the right after extension 4 78
JQuery on multiple lines 3 48
Read text on Table 7 49
Boolean 13 50
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question