HttpWebRequest problem: Please help

S

Sojwal

We are working on a asp.net application in which we need to send some
data to a PHP application on another server. We are using
HttpWebRequest object to 'POST' the data to a PHP page as key-value
pairs, which will be accessed by the PHP script as posted variables.
The requirement is to name all keys in the posted data as the same
name, which ideally should result in getting an array of the data on
the PHP side. For example, if data is sent as key=abc&key=def&key=123"
then the PHP page should get an array containing members "abc", "def"
& "123". This is not happening..what we get on PHP side is a single
comma
separated string like "abc,def,123". The code for posting form data
using HttpWebRequest is standard as shown on many sites. What are we
doing wrong here?
Thanks in advance.
 
S

Scott Allen

Hi Sojwal:

A tool you can use is Fiddler:
http://www.fiddlertool.com/fiddler/

What I'd do is capture the web request your application makes and
capture a web request made by a browser (or something that is sending
the correct reauest to the PHP app). Then you can compare the payload
of the two requests to see what you might be missing.
 
J

Joerg Jooss

Sojwal said:
We are working on a asp.net application in which we need to send some
data to a PHP application on another server. We are using
HttpWebRequest object to 'POST' the data to a PHP page as key-value
pairs, which will be accessed by the PHP script as posted variables.
The requirement is to name all keys in the posted data as the same
name, which ideally should result in getting an array of the data on
the PHP side. For example, if data is sent as key=abc&key=def&key=123"
then the PHP page should get an array containing members "abc", "def"
& "123". This is not happening..what we get on PHP side is a single
comma
separated string like "abc,def,123". The code for posting form data
using HttpWebRequest is standard as shown on many sites. What are we
doing wrong here?

Show your code anyway ;-)

Cheers,
 
S

Sojwal

Joerg Jooss said:
Show your code anyway ;-)

Cheers,

The problem was solved by posting the data as
"key[]=abc&key[]=def&key[]=123" as required by PHP. But thanks for
replying to my post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top