Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Proxy SendAndLoad

Status
Not open for further replies.

mike314

Programmer
Jun 24, 2003
143
US
When doing an xml sendAndLoad of sending xml data is it possible to use a php proxy file (which exists on your site) that basically readsfile to an external url if the url doesnt exist on your site?
 
I'm having trouble with either the proxy or just the way my script is set up because its never sending the xml. All I'm doing is creating xml and sending it, but it always fails. Is there something obvious missing?????


function submitFiles() {
var myXML:XML = new XML();
var topLevel:XMLNode = myXML.createElement("Request");
var sentFrom:XMLNode = myXML.createElement("Sent From");
var fileIDElement:XMLNode = myXML.createElement("fileId");
var entryField:XMLNode = myXML.createElement("entry");
var descript:XMLNode = myXML.createElement("description");
var isOnline:XMLNode = myXML.createElement("Connected");

var textNode1:XMLNode = myXML.createTextNode("error@yoursite.com");
var textNode2:XMLNode = myXML.createTextNode("34942563");
var textNode3:XMLNode = myXML.createTextNode(_root.text_field.text);
var textNode4:XMLNode = myXML.createTextNode("Bad file check");
var textNode5:XMLNode = myXML.createTextNode("true");


myXML.appendChild(topLevel);
topLevel.appendChild(sentFrom);
topLevel.appendChild(fileIDElement);
topLevel.appendChild(entryField);
topLevel.appendChild(descript);
topLevel.appendChild(isOnline);

sentFrom.appendChild(textNode1);
fileIDElement.appendChild(textNode2);
entryField.appendChild(textNode3);
descript.appendChild(textNode4);
isOnline.appendChild(textNode5);

var SendLoginReply_xml:XML = new XML();
SendLoginReply_xml.ignoreWhite = true;

SendLoginReply_xml.onLoad = loadedXML;


SendLoginReply_xml.onData = function(src:String){
if(src != undefined){
this.parseXML(src);
var tempString = SendLoginReply_xml.firstChild.firstChild.toString();
var testString = tempString.substring(8,9);
if (testString == 0){
this.loaded = true;
this.onLoad(true);
}else{
trace("Didnt pass")
}
}
}

myXML.contentType = "text/xml";
myXML.sendAndLoad("sendProxyFile.php", SendLoginReply_xml);

}
function loadedXML(success:Boolean) {
if (success) {
trace("Transfer Succeeded");
} else {
trace("connection failed")
}
}


thanks
 
the php is just a proxy file that uses readfile($myURL);
where myURL is an external site that is collecting my xml.

problem is I always get to the "Didnt pass" from the onData function and the data is never recieved.

So instead of creating xml using the xml object I should just pass it as "<Request></Request>" ???
 
still doesnt pass

in place of all the xml I placed this

submittedData = new LoadVars();
submittedData.inputData = "all actual xml blah blah"

then did this

submittedData.sendAndLoad("sendProxyFile.php", SendLoginReply_xml);

If I get rid of the onData function, I get a "Transfer Succeeded" but the data is never received.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top