Problems with xml and php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lyn Hartley

    Problems with xml and php

    I wan't to send a string containing XML to a Microsoft XML gateway.

    I'm using the include code below as an include and calling the function with
    somthing like the calling code. I have sent the streem to a port listener
    and all is fine but when its sent to the gateway I just get a Incorrect
    RequestType.

    I'm just wondering if anyone knows what I'm missing or doing wrong, I can
    find an abundance if info on parceing XML but idealy I just want a class to
    SEND an XML string.
    Any help would be appriciated..

    Thanx
    Lyn
    *********Callin g Code*********** **
    $server = "192.168.0. 5";
    $port = "80";
    $req = stripslashes('< \?xml version = "1.0"\?><!DOCTY PE ScheduleRequest
    SYSTEM "ScheduleReques t.dtd"><Schedul eRequest
    version="1.2.4" ><Site><SiteID> 28</SiteID><StartDa te>20031128</StartDate><End
    Date>20031128</EndDate></Site></ScheduleRequest >');
    $tx = 'XMLGateway/xmlgateway.asp' ;
    $rx = txrx($server, $port, $tx, $req);
    *******code end************ *******

    **********Inclu de Code*********** **
    <?
    function txrx($server, $port, $tx, $req){
    $rx = "";
    if ($server == ""){$rx = "Error - Missing Server";}
    if ($port == ""){$rx = "Error - Missing Port";}
    //if ($tx == "") {$rx = "Error - No data to send";}
    if ($rx == "") {
    $tx = "GET /$tx HTTP/1.0\x0D\x0A";
    $length = strlen($encreq) ;
    $tx .= "\x0D\x0A"; // THE END
    $tx .= $req;

    }
    //echo $tx;
    $fp = fsockopen($serv er, $port);
    if($fp) {
    fputs($fp, $tx);
    while(!feof($fp )) {
    $rx .= fread($fp, 1000); }
    fclose($fp);
    }
    return $rx;

    }

    ?>
    **********Code End***********




  • Zurab Davitiani

    #2
    Re: Problems with xml and php

    Lyn Hartley wrote on Tuesday 09 December 2003 07:09:
    [color=blue]
    > I wan't to send a string containing XML to a Microsoft XML gateway.
    >
    > I'm using the include code below as an include and calling the function
    > with somthing like the calling code. I have sent the streem to a port
    > listener and all is fine but when its sent to the gateway I just get a
    > Incorrect RequestType.[/color]

    <snip>
    [color=blue]
    > $tx = "GET /$tx HTTP/1.0\x0D\x0A";[/color]

    I think you should be doing a POST request, not GET; hence, the error.

    --
    Business Web Solutions
    ActiveLink, LLC

    Comment

    Working...