Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > RSS and Atom
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
RSS and Atom Ask questions, get answers, discuss creating RSS and Atom feeds or programming apps or sites that create or consume RSS/Atom. Please leave any RSS/Atom politics out of this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the RSS and Atom section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 12th, 2005, 12:37 PM
Registered User
Join Date: Jul 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default xmlhttp

function testXMLHTTP(){
    var docXML = loadXMLDoc("dummy.xml", false);
    postXMLDoc(docXML, "./echo.php", true);//"ciao"

///////////////// xmlhttp section ///////////////////
function initReq(){
    if (window.req){
    //delete req;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
      req = new XMLHttpRequest();

  // branch for IE/Windows ActiveX version
  } else if (window.ActiveXObject) {
      req = new ActiveXObject("Msxml2.XMLHTTP.4.0");

function postXMLDoc(doc, url, async){
    //async = true;
    if (async){
      req.onreadystatechange = postReqChange;
  req.open("POST", url, async);
  req.setRequestHeader('content-type', 'text/xml');
  if (!async){
      alert("mandato: "+req.responseText);

function postReqChange() {
  // only if req shows "loaded"
  if (req.readyState == 4) {
    // only if "OK"
    if (req.status == 200) {
    } else {
            alert("There was a problem retrieving the XML data:\n" +req.statusText);

///////////php script//////////////// (echo.php)

            $sXML = $GLOBALS['HTTP_RAW_POST_DATA'];

      echo "$sXML";

      // Open a text file and erase the contents if any
      $fp = fopen("posted.xml", "w");

      // Write the data to the file
      fwrite($fp, $sXML);

      // Close the file

      //$headers = getallheaders();
      /*foreach ($headers as $name => $content) {
      echo "$name = $content<br>n";
      //echo "{$headers["my-header"]}";

//////////////////////xml document////////////////////// (dummy.xml)

<progetto id="0"><schema id="schF0" tipo="schemaFunzionale"><schemaFunzionale/><oggetto id="imm0" tipo="immagine" x="50" y="50"><immagine nomeFile="cacca.jpg"/><etichettaAssociata id="etich0"/></oggetto><oggetto id="etich0" tipo="etichetta" x="100" y="100"><etichetta idOggettoEtichettato="imm0">commento cacca</etichetta></oggetto></schema></progetto>


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
xmlhttp help ojaynet RSS and Atom 2 April 8th, 2005 04:13 PM
XMLHTTP ffbalota Classic ASP XML 7 October 7th, 2003 05:11 PM
XMLHTTP ffbalota ASP.NET 1.0 and 1.1 Professional 1 August 16th, 2003 01:29 PM
XMLHTTP ffbalota Classic ASP Professional 0 June 25th, 2003 02:44 PM

All times are GMT -4. The time now is 03:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.