473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HttpWebRequest problem: Please help

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.
Jul 21 '05 #1
2 1270
Sojwal <so************@hotmail.com> wrote:
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?


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in message news:<MP************************@msnews.microsoft. com>...
Sojwal <so************@hotmail.com> wrote:
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?


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.


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. I did read your helpful article on 'short but
complete program' & will keep this in mind when posting to newsgroups.
Thanks for the tips. :-)
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
3
by: ME | last post by:
Hi; I am getting "Unhandled Exception: System.Net.WebException: The remote server returned an erro r: (401) Unauthorized." when I am trying to get a page via post. Code follows...
4
by: R Reyes | last post by:
I am trying to code a file uploader (for forum/email attachments) from the client computer to a remote web server via the PUT method (since POST is not allowed ). However, the upload works ONLY...
5
by: japslam japslam via DotNetMonster.com | last post by:
Hi all, I have problem when I use HttpWebRequest and take long time to call to my service server. If at that time there are many request comes in semultaneous, I will get this exception ...
7
by: gorkos | last post by:
Hi, I am two days trying to solve a problem with some pages, which i get through HTTPWebRequest. Error is that some pages need Script to be enabled. But how to do this in HTTPWebRequest class?
0
by: boxboy | last post by:
Hi, I'm writing a console application and am having a problem with HttpWebRequest when posting data to a webserver. A "System.Net.WebException: The server committed a protocol violation" is always...
3
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to...
4
by: Natalia | last post by:
Hello, I need to provide the ability to post file and some form elements via our website (asp.net) to the third party website (asp page). On http://aspalliance.com/236#Page4 - I found great...
7
by: Marc Bartsch | last post by:
Hi, I have a background worker in my C# app that makes a synchronous HttpWebRequest.GetResponse() call. The idea is to POST a file to a server on the internet. When I call HttpWebRequest.Abort()...
2
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0. This problem can be shown when trying to access a WebService using SSL and through a proxy server after using the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.