Vikas Ahlawat

Vikas Ahlawat

  • NA
  • 564
  • 819k

can any one covert this PHP code in ASP.net ?

Nov 19 2010 2:35 AM

<?php

// ----- Variables -----

$host = 'abc.xyx.com';

$uri = '/test/gbp/xmlHandler.php';

// ----- XML Login Message ----- //

$xmlmessage = "message=";

$xmlmessage .= "<Request>";

$xmlmessage .= "<LoginRequest>";

$xmlmessage .= "<Source>AGENT</Source>";

$xmlmessage .= "<AgentId>******</AgentId>";       

$xmlmessage .= "<Password>******</Password>";    

$xmlmessage .= "<UserId>******</UserId>";      

$xmlmessage .= "</LoginRequest>";

$xmlmessage .= "</Request>";

// ----- Compose HTTP request header -----

$header = "POST $uri HTTP/1.1\r\n";

$header .= "Host: $host\r\n";

$header .= "Accept: */*\r\n";

$header .= "Content-Length: ".strlen($xmlmessage)."\r\n";

$header .= "Content-Type: application/x-www-form-urlencoded\r\n\r\n";

 

// ----- Open up connection to Travelpack XML Server -----

$fp = fsockopen($host, 80, $errno, $errstr);

    fputs($fp, $header.$xmlmessage);

 

// ----- Read the Reply -----

    $output = "";

    while (!feof($fp)) {

        $output = fgets($fp, 128);

        echo $output;

    }

 

// ----- We are done -----

    fclose($fp);

?>