Solved

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

Posted on 2012-04-04
2
307 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

632 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