By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,051 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,051 IT Pros & Developers. It's quick & easy.

HELP: No POST data found from a ASPX Script HTTPWebRequest into a PHP Page

P: n/a
We are working with a vendor who is trying to post some some XML data
to us. They are using an ASPX script to post to a PHP page of ours.
The problem is that in the PHP page, I cannot find any kind of POST,
GET or REQUEST data at all. Is there something that they or we are
doing wrong? Is there somewhere else that PHP/Apache hide the data?
The one thing I see in the PHP global variables that I don't
understand is the HTTP_EXPECT=100-continue. What does that mean and
is it affecting anything?

This is the script that they are using:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.IO;
using System.Xml;
using System.Text;
using System.Net;
using System.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace WebServices
{
public class GwsXmlPost : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox xmlAmbitRequest;
protected System.Web.UI.WebControls.Button btnSubmit;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web
Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{
this.btnSubmit.Click += new
System.EventHandler(this.btnSubmit_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnSubmit_Click(object sender, System.EventArgs
e)
{
StreamWriter myWriter = null;
string sUrlEncodeString = string.Empty;

sUrlEncodeString =
Server.UrlEncode(xmlAmbitRequest.Text.ToString());

HttpWebRequest webreq =
(HttpWebRequest)WebRequest.Create(ConfigurationSet tings.AppSettings["PostUrl"]);

webreq.ContentType =
"application/x-www-form-urlencoded";
webreq.Method = "POST";
webreq.ContentLength = sUrlEncodeString.Length;

try
{
myWriter = new
StreamWriter(webreq.GetRequestStream());
myWriter.Write(sUrlEncodeString);
}
catch (Exception ex)
{
ex = ex;
}
finally
{
myWriter.Close();
}

try
{
HttpWebResponse response =
(HttpWebResponse)webreq.GetResponse();
String ver = response.ProtocolVersion.ToString();
StreamReader reader = new
StreamReader(response.GetResponseStream() );
string str = reader.ReadToEnd();

xmlAmbitRequest.Text = str;
}
catch (Exception aEx)
{
aEx=aEx;
}
}
}
}
The $_POST, $_GET and $_REQUEST are blank arrays. This is $_SERVER
(minus some identifying information):

CONTENT_LENGTH=>3672
CONTENT_TYPE=>application/x-www-form-urlencoded
DOCUMENT_ROOT=>/usr/local/apache/htdocs
HTTP_EXPECT=>100-continue
HTTP_HOST=>xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PATH=>/usr/sbin:/usr/bin:/export/home/sybase:/export/home/sybase/OCS-12_0/bin:/export/local/bin:/usr/ccs/bin:/export/local/lib
REMOTE_ADDR=>63.74.114.208
REMOTE_PORT=>4596
SCRIPT_FILENAME=>/usr/local/apache/htdocs/xml/index.php
SERVER_ADDR=>xxxxxxxxxxxxxx
SERVER_ADMIN=>xxxxxxxxxxxxxxxxxxxxx
SERVER_NAME=>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SERVER_PORT=>80
SERVER_SIGNATURE=><ADDRESS>Apache/1.3.28 Server at
xxxxxxxxxxxxxxxxxxxxxxxxx.com Port 80</ADDRESS>
SERVER_SOFTWARE=>Apache/1.3.28 (Unix) PHP/4.3.3
GATEWAY_INTERFACE=>CGI/1.1
SERVER_PROTOCOL=>HTTP/1.1
REQUEST_METHOD=>POST
QUERY_STRING=>
REQUEST_URI=>/xml/index.php
SCRIPT_NAME=>/xml/index.php
PATH_TRANSLATED=>/usr/local/apache/htdocs/xml/index.php
PHP_SELF=>/xml/index.php

This is getallheaders()

Content-Length=>3672
Content-Type=>application/x-www-form-urlencoded
Expect=>100-continue
Host=>xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

If you are that way inclined, you can get 500 points on
experts-exchange.com for answering this:

http://www.experts-exchange.com/Web/..._20766981.html

Thanks
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.