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.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Sess ionState;
using System.IO;
using System.Xml;
using System.Text;
using System.Net;
using System.Configur ation;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.H tmlControls;
namespace WebServices
{
public class GwsXmlPost : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Text Box xmlAmbitRequest ;
protected System.Web.UI.W ebControls.Butt on btnSubmit;
private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
//
// CODEGEN: This call is required by the ASP.NET Web
Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}
private void InitializeCompo nent()
{
this.btnSubmit. Click += new
System.EventHan dler(this.btnSu bmit_Click);
this.Load += new System.EventHan dler(this.Page_ Load);
}
#endregion
private void btnSubmit_Click (object sender, System.EventArg s
e)
{
StreamWriter myWriter = null;
string sUrlEncodeStrin g = string.Empty;
sUrlEncodeStrin g =
Server.UrlEncod e(xmlAmbitReque st.Text.ToStrin g());
HttpWebRequest webreq =
(HttpWebRequest )WebRequest.Cre ate(Configurati onSettings.AppS ettings["PostUrl"]);
webreq.ContentT ype =
"applicatio n/x-www-form-urlencoded";
webreq.Method = "POST";
webreq.ContentL ength = sUrlEncodeStrin g.Length;
try
{
myWriter = new
StreamWriter(we breq.GetRequest Stream());
myWriter.Write( sUrlEncodeStrin g);
}
catch (Exception ex)
{
ex = ex;
}
finally
{
myWriter.Close( );
}
try
{
HttpWebResponse response =
(HttpWebRespons e)webreq.GetRes ponse();
String ver = response.Protoc olVersion.ToStr ing();
StreamReader reader = new
StreamReader(re sponse.GetRespo nseStream() );
string str = reader.ReadToEn d();
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=>a pplication/x-www-form-urlencoded
DOCUMENT_ROOT=>/usr/local/apache/htdocs
HTTP_EXPECT=>10 0-continue
HTTP_HOST=>xxxx xxxxxxxxxxxxxxx xxxxxxxxxx
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=>45 96
SCRIPT_FILENAME =>/usr/local/apache/htdocs/xml/index.php
SERVER_ADDR=>xx xxxxxxxxxxxx
SERVER_ADMIN=>x xxxxxxxxxxxxxxx xxxxx
SERVER_NAME=>xx xxxxxxxxxxxxxxx xxxxxxxxxxxxx
SERVER_PORT=>80
SERVER_SIGNATUR E=><ADDRESS>Apa che/1.3.28 Server at
xxxxxxxxxxxxxxx xxxxxxxxxx.com Port 80</ADDRESS>
SERVER_SOFTWARE =>Apache/1.3.28 (Unix) PHP/4.3.3
GATEWAY_INTERFA CE=>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=>applicati on/x-www-form-urlencoded
Expect=>100-continue
Host=>xxxxxxxxx xxxxxxxxxxxxxxx xxxxx
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