อยากแปลง Curl ของ PHP ให้เป็น Curl ของ VB.Net หนอ่ยครับ
Code (PHP)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://xxx.com/xml/xml_search.php");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "xml_rate=".urlencode($xml_rates));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
Tag : .NET, Web (ASP.NET), VB.NET
ประวัติการแก้ไข 2014-05-19 13:52:25
Date :
2014-05-19 13:40:45
By :
nut_ch31
View :
2054
Reply :
12
VB.NET น่าจะใช้ WebClient ครับ
Code (VB.NET)
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Namespace Examples.System.Net
Public Class WebRequestPostExample
Public Shared Sub Main()
' Create a request using a URL that can receive a post.
Dim request As WebRequest = WebRequest.Create("http://www.contoso.com/PostAccepter.aspx ")
' Set the Method property of the request to POST.
request.Method = "POST"
' Create POST data and convert it to a byte array.
Dim postData As String = "This is a test that posts this string to a Web server."
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
' Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded"
' Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length
' Get the request stream.
Dim dataStream As Stream = request.GetRequestStream()
' Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length)
' Close the Stream object.
dataStream.Close()
' Get the response.
Dim response As WebResponse = request.GetResponse()
' Display the status.
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
' Get the stream containing content returned by the server.
dataStream = response.GetResponseStream()
' Open the stream using a StreamReader for easy access.
Dim reader As New StreamReader(dataStream)
' Read the content.
Dim responseFromServer As String = reader.ReadToEnd()
' Display the content.
Console.WriteLine(responseFromServer)
' Clean up the streams.
reader.Close()
dataStream.Close()
response.Close()
End Sub
End Class
End Namespace
Date :
2014-05-19 16:35:51
By :
mr.win
พี่แอดมินจ๊า ได้แล้วจ๊า แต่มีอีกคำถามคือ
Code (ASP)
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Xml
Imports System.Xml.Linq
Imports System.Net
Imports System.IO
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim xmlDoc As New StringBuilder
Dim USERNAME As String = "agent99"
Dim PASSWORD As String = "202808"
Dim SORT As String = "P"
Dim CHECKINDATE As String = "20140610"
Dim DURATION As String = "1"
Dim COUNTRY_CODE As String = "THA"
Dim CITY As String = "BKK"
Dim SERVICE As String = ""
Dim NALTIONALITY As String = "JP"
Dim ADULT_NO As String = "1"
Dim CHILD_NO As String = "0"
Dim QUANTITY As String = "1"
'Response.Write(HAOutput)
'Dim xmlDoc As New XMLDocument
xmlDoc.Append("<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<FTSXML_FAH>" & _
"<VERSION>1.0</VERSION>" & _
"<USER_TOKEN>TOKEN</USER_TOKEN>" & _
"<LOGIN_INFO>" & _
"<USERNAME>" & USERNAME & "</USERNAME>" & _
"<PASSWORD>" & PASSWORD & "</PASSWORD>" & _
"</LOGIN_INFO>" & _
"<SEARCH>" & _
"<SORT>" & SORT & "</SORT>" & _
"<STAYPERIOD>" & _
"<CHECKINDATE>" & CHECKINDATE & "</CHECKINDATE>" & _
"<DURATION>" & DURATION & "</DURATION>" & _
"</STAYPERIOD>" & _
"<COUNTRY_CODE>" & COUNTRY_CODE & "</COUNTRY_CODE>" & _
"<CITY>" & CITY & "</CITY>" & _
"<HOTELPARAMS>" & _
"<SERVICE>" & SERVICE & "</SERVICE>" & _
"<NALTIONALITY>" & NALTIONALITY & "</NALTIONALITY>" & _
"</HOTELPARAMS>" & _
"<ROOMS>" & _
"<ROOM>" & _
"<ADULT_NO>" & ADULT_NO & "</ADULT_NO>" & _
"<CHILD_NO>" & CHILD_NO & "</CHILD_NO>" & _
"<QUANTITY>" & QUANTITY & "</QUANTITY>" & _
"</ROOM>" & _
"</ROOMS>" & _
"</SEARCH>" & _
"</FTSXML_FAH>")
Dim encoding As ASCIIEncoding = New ASCIIEncoding()
Dim postxml_rate As String
postxml_rate = "xml_rate=" + xmlDoc.ToString()
Dim xml_rate() As Byte
xml_rate = encoding.GetBytes(postxml_rate)
' Prepare web request...
Dim myRequest As HttpWebRequest
myRequest = CType(WebRequest.Create("https://www.xxx.travel/xml/xml_search.php"), HttpWebRequest)
myRequest.Method = "POST"
myRequest.ContentType = "application/x-www-form-urlencoded"
myRequest.ContentLength = xml_rate.Length
Dim newStream As Stream = myRequest.GetRequestStream()
' Send the xml_rate.
newStream.Write(xml_rate, 0, xml_rate.Length)
' Get the response
Dim myResponse As HttpWebResponse
myResponse = myRequest.GetResponse()
'Response.Write(myResponse)
'MsgBox(myResponse)
End Sub
End Class
ตรง MyResponse อ่ะ น่าจะเป็น Xml ที่ return มาจาก ที่ผมเขียนอ่ะคัรบ แล้วผมจะแจกแจงในลักษณะแบบ PHp อย่างไรหรอครับ
คำถามคือ ใน Vb.net มันมี function คล้ายๆ กับ simplexml_load_string ไหม๊ครับ
Code (PHP)
$xml_data = simplexml_load_string($result);
foreach($xml_data->HOTEL as $Type) {
$SEQNO = $Type->SEQNO[0];
$GRADE = $Type->GRADE[0];
$ADDRESS = $Type->ADDRESS[0];
$HOTELID = $Type->HOTELID[0];
$HOTELNAME = $Type->HOTELNAME[0];
$COUNTRY_ID = $Type->COUNTRY_ID[0];
$CITY = $Type->CITY[0];
$CHECK_IN_DATE = $Type->CHECK_IN_DATE[0];
$CHECK_OUT_DATE = $Type->CHECK_OUT_DATE[0];
$CANCEL_DUE_DATE1 = $Type->CANCELLATION_POLICY->CHARGE1->CANCEL_DUE_DATE[0];
$CANCEL_NIGHT_CHARGE1 = $Type->CANCELLATION_POLICY->CHARGE1->CANCEL_NIGHT_CHARGE[0];
$CANCEL_DUE_DATE2 = $Type->CANCELLATION_POLICY->CHARGE2->CANCEL_DUE_DATE[0];
$CANCEL_NIGHT_CHARGE2 = $Type->CANCELLATION_POLICY->CHARGE2->CANCEL_NIGHT_CHARGE[0];
$CANCEL_DUE_DATE3 = $Type->CANCELLATION_POLICY->CHARGE3->CANCEL_DUE_DATE[0];
$CANCEL_NIGHT_CHARGE3 = $Type->CANCELLATION_POLICY->CHARGE3->CANCEL_NIGHT_CHARGE[0];
$CANCEL_DUE_DATE4 = $Type->CANCELLATION_POLICY->CHARGE4->CANCEL_DUE_DATE[0];
$CANCEL_NIGHT_CHARGE4 = $Type->CANCELLATION_POLICY->CHARGE4->CANCEL_NIGHT_CHARGE[0];
$HOTEL_REMARK = $Type->HOTEL_REMARK[0];
$SUBSERVICE = $Type->SUBSERVICE[0];
echo "<BR><BR>";
echo "SEQNO : ".$SEQNO."<BR>";
echo "GRADE : ".$GRADE."<BR>";
echo "ADDRESS : ".$ADDRESS."<BR>";
echo "HOTELID : ".$HOTELID."<BR>";
echo "HOTELNAME : ".$HOTELNAME."<BR>";
echo "COUNTRY_ID : ".$COUNTRY_ID."<BR>";
echo "CITY : ".$CITY."<BR>";
echo "CHECK_IN_DATE : ".$CHECK_IN_DATE."<BR>";
echo "CHECK_OUT_DATE : ".$CHECK_OUT_DATE."<BR>";
echo "CANCEL_DUE_DATE1 : ".$CANCEL_DUE_DATE1."<BR>";
echo "CANCEL_NIGHT_CHARGE1 : ".$CANCEL_NIGHT_CHARGE1."<BR>";
echo "CANCEL_DUE_DATE2 : ".$CANCEL_DUE_DATE2."<BR>";
echo "CANCEL_NIGHT_CHARGE2 : ".$CANCEL_NIGHT_CHARGE2."<BR>";
echo "CANCEL_DUE_DATE3 : ".$CANCEL_DUE_DATE3."<BR>";
echo "CANCEL_NIGHT_CHARGE3 : ".$CANCEL_NIGHT_CHARGE3."<BR>";
echo "CANCEL_DUE_DATE4 : ".$CANCEL_DUE_DATE4."<BR>";
echo "CANCEL_NIGHT_CHARGE4 : ".$CANCEL_NIGHT_CHARGE4."<BR>";
foreach($Type->ROOMINFO as $Typ) {
$ROOM_TYPE_ID = $Typ->ROOM_TYPE_ID[0];
$ROOM_CATEGORY = $Typ->ROOM_CATEGORY[0];
$ROOM_NAME = $Typ->ROOM_NAME[0];
$ROOM_AVAILABILITY = $Typ->ROOM_AVAILABILITY[0];
$BB_CODE = $Typ->BB_CODE[0];
$PRICE_PER = $Typ->PRICE_PER[0];
$PRICE_CURRENCY = $Typ->PRICE_CURRENCY[0];
$PRICE_UNIT = $Typ->PRICE_UNIT[0];
$PRICE_TOTAL = $Typ->PRICE_TOTAL[0];
echo "ROOM_TYPE_ID : ".$ROOM_TYPE_ID."<BR>";
echo "ROOM_CATEGORY : ".$ROOM_CATEGORY."<BR>";
echo "ROOM_NAME : ".$ROOM_NAME."<BR>";
echo "ROOM_AVAILABILITY : ".$ROOM_AVAILABILITY."<BR>";
echo "BB_CODE : ".$BB_CODE."<BR>";
echo "PRICE_PER : ".$PRICE_PER."<BR>";
echo "PRICE_CURRENCY : ".$PRICE_CURRENCY."<BR>";
echo "PRICE_UNIT : ".$PRICE_UNIT."<BR>";
echo "PRICE_TOTAL : ".$PRICE_TOTAL."<BR>";
}
echo "HOTEL_REMARK : ".$HOTEL_REMARK."<BR>";
echo "SUBSERVICE : ".$SUBSERVICE."<BR>";
}
Date :
2014-05-19 16:50:03
By :
nut_ch31
ไม่เปลี่ยนเป็น JSON แทนล่ะครับ ใช้ง่ายกว่าน่ะครับ
Date :
2014-05-19 16:56:03
By :
mr.win
Y Y ทำไม่เป็นอ่ะครับ พี่
Date :
2014-05-19 17:01:37
By :
nut_ch31
บน VB.Net ก็มี Function XML Reader ครับ ลองหาดูครับ ไม่ยาก สามารถแปลงเป็นพวก DataSet หรือ DataTable ได้
Date :
2014-05-19 17:06:16
By :
mr.win
ตอนนี้เหลือ แค่ ส่วนการแปลง ค่า
Code (ASP)
' Get the response
Dim myResponse As HttpWebResponse
myResponse = myRequest.GetResponse()
อ่ะครับ โดยค่าที่ได้รับจะมาเป็นรูปแบบของ XML พอจะมี Function ในการแปลงไหม๊คัรบ
Date :
2014-05-19 17:07:21
By :
nut_ch31
Code (VB.NET)
Dim output As StringBuilder = New StringBuilder()
Dim xmlString As String = "<?xml version='1.0'?>" & _
"<!-- This is a sample XML document -->" & _
"<Items>" & _
"<Item>test with a child element <more/> stuff</Item>" & _
"</Items>"
' Create an XmlReader
Using reader As XmlReader = XmlReader.Create(New StringReader(xmlString))
Dim ws As XmlWriterSettings = New XmlWriterSettings()
ws.Indent = True
Using writer As XmlWriter = XmlWriter.Create(output, ws)
' Parse the file and display each of the nodes.
While reader.Read()
Select Case reader.NodeType
Case XmlNodeType.Element
writer.WriteStartElement(reader.Name)
Case XmlNodeType.Text
writer.WriteString(reader.Value)
Case XmlNodeType.XmlDeclaration
Case XmlNodeType.ProcessingInstruction
writer.WriteProcessingInstruction(reader.Name, reader.Value)
Case XmlNodeType.Comment
writer.WriteComment(reader.Value)
Case XmlNodeType.EndElement
writer.WriteFullEndElement()
End Select
End While
End Using
End Using
OutputTextBlock.Text = output.ToString()
Date :
2014-05-19 17:12:00
By :
mr.win
Code (VB.NET)
Dim output As StringBuilder = New StringBuilder()
Dim xmlString As String = _
"<bookstore>" & _
"<book genre='autobiography' publicationdate='1981-03-22' ISBN='1-861003-11-0'>" & _
"<title>The Autobiography of Benjamin Franklin</title>" & _
"<author>" & _
"<first-name>Benjamin</first-name>" & _
"<last-name>Franklin</last-name>" & _
"</author> " & _
"<price>8.99</price>" & _
"</book>" & _
"</bookstore>"
' Create an XmlReader
Using reader As XmlReader = XmlReader.Create(New StringReader(xmlString))
reader.ReadToFollowing("book")
reader.MoveToFirstAttribute()
Dim genre As String = reader.Value
output.AppendLine("The genre value: " + genre)
reader.ReadToFollowing("title")
output.AppendLine("Content of the title element: " + reader.ReadElementContentAsString())
End Using
OutputTextBlock.Text = output.ToString()
Date :
2014-05-19 17:12:25
By :
mr.win
ที่พี่ให้มา มันก็ใช้ได้น่ะครับ แต่ผมเอาไปดัดแปลง ใช้กับผมไม่ได้อ่ะพี่ คอื XML ที่ผม Return จะ Return ในลักษณะนี้อ่ะครับ
Code (XML)
<?xml version="1.0" encoding="utf-8"?>
<FTSXML_FAHR>
<VERSION/>
<SESSION_ID/>
<USER_TOKEN/>
<HOTEL>
<SEQNO>1</SEQNO>
<GRADE>3*</GRADE>
<ADDRESS>2 Samsen Road, Banglumphu, Pranakorn,Bangkok</ADDRESS>
<HOTELID>NEL</HOTELID>
<HOTELNAME>NEW WORLD CITY HOTEL</HOTELNAME>
<COUNTRY_ID>THA</COUNTRY_ID>
<CITY>BKK</CITY>
<CHECK_IN_DATE>2014 MAY 10</CHECK_IN_DATE>
<CHECK_OUT_DATE>2014 MAY 11</CHECK_OUT_DATE>
<CANCELLATION_POLICY>
<CHARGE1>
<CANCEL_DUE_DATE>2014 APRIL 24</CANCEL_DUE_DATE>
<CANCEL_NIGHT_CHARGE>0</CANCEL_NIGHT_CHARGE>
</CHARGE1>
<CHARGE2>
<CANCEL_DUE_DATE>2014 APRIL 25</CANCEL_DUE_DATE>
<CANCEL_NIGHT_CHARGE>1</CANCEL_NIGHT_CHARGE>
</CHARGE2>
<CHARGE3>
<CANCEL_DUE_DATE>2014 MAY 02</CANCEL_DUE_DATE>
<CANCEL_NIGHT_CHARGE>1</CANCEL_NIGHT_CHARGE>
</CHARGE3>
<CHARGE4>
<CANCEL_DUE_DATE>2014 MAY 06</CANCEL_DUE_DATE>
<CANCEL_NIGHT_CHARGE>1</CANCEL_NIGHT_CHARGE>
</CHARGE4>
</CANCELLATION_POLICY>
<ROOMINFO>
<ROOM_TYPE_ID>SP </ROOM_TYPE_ID>
<ROOM_CATEGORY>SG </ROOM_CATEGORY>
<ROOM_NAME>SUPERIOR / SINGLE ROOM</ROOM_NAME>
<ROOM_AVAILABILITY>A</ROOM_AVAILABILITY>
<BB_CODE>BB</BB_CODE>
<PRICE_PER>R</PRICE_PER>
<PRICE_CURRENCY>THB</PRICE_CURRENCY>
<PRICE_UNIT>950.00</PRICE_UNIT>
<PRICE_TOTAL>950.00</PRICE_TOTAL>
</ROOMINFO>
<ROOMINFO>
<ROOM_TYPE_ID>DX </ROOM_TYPE_ID>
<ROOM_CATEGORY>SG </ROOM_CATEGORY>
<ROOM_NAME>DELUXE / SINGLE ROOM</ROOM_NAME>
<ROOM_AVAILABILITY>A</ROOM_AVAILABILITY>
<BB_CODE>BB</BB_CODE>
<PRICE_PER>R</PRICE_PER>
<PRICE_CURRENCY>THB</PRICE_CURRENCY>
<PRICE_UNIT>950.00</PRICE_UNIT>
<PRICE_TOTAL>950.00</PRICE_TOTAL>
</ROOMINFO>
<HOTEL_REMARK/>
</HOTEL>
<HOTEL>
<SEQNO>2</SEQNO>
<GRADE>3*</GRADE>
<ADDRESS>88/19 Ratchaprarop Road, Phayathai, Ratchathewi,Bangkok</ADDRESS>
<HOTELID>CTN</HOTELID>
<HOTELNAME>CITIN PRATUNAM</HOTELNAME>
<COUNTRY_ID>THA</COUNTRY_ID>
<CITY>BKK</CITY>
<CHECK_IN_DATE>2014 MAY 10</CHECK_IN_DATE>
<CHECK_OUT_DATE>2014 MAY 11</CHECK_OUT_DATE>
<CANCELLATION_POLICY>
<CHARGE1>
<CANCEL_DUE_DATE>2014 APRIL 24</CANCEL_DUE_DATE>
<CANCEL_NIGHT_CHARGE>0</CANCEL_NIGHT_CHARGE>
</CHARGE1>
<CHARGE2>
<CANCEL_DUE_DATE>2014 APRIL 25</CANCEL_DUE_DATE>
<CANCEL_NIGHT_CHARGE>1</CANCEL_NIGHT_CHARGE>
</CHARGE2>
<CHARGE3>
<CANCEL_DUE_DATE>2014 MAY 02</CANCEL_DUE_DATE>
<CANCEL_NIGHT_CHARGE>1</CANCEL_NIGHT_CHARGE>
</CHARGE3>
<CHARGE4>
<CANCEL_DUE_DATE>2014 MAY 06</CANCEL_DUE_DATE>
<CANCEL_NIGHT_CHARGE>1</CANCEL_NIGHT_CHARGE>
</CHARGE4>
</CANCELLATION_POLICY>
<ROOMINFO>
<ROOM_TYPE_ID>SPSO</ROOM_TYPE_ID>
<ROOM_CATEGORY>SG </ROOM_CATEGORY>
<ROOM_NAME>SUPERIOR STUDIO (13-14) / SINGLE ROOM</ROOM_NAME>
<ROOM_AVAILABILITY>A</ROOM_AVAILABILITY>
<BB_CODE>BB</BB_CODE>
<PRICE_PER>R</PRICE_PER>
<PRICE_CURRENCY>THB</PRICE_CURRENCY>
<PRICE_UNIT>1320.00</PRICE_UNIT>
<PRICE_TOTAL>1,320.00</PRICE_TOTAL>
</ROOMINFO>
<HOTEL_REMARK>Daily breakfast is available all with Vegetarian Buffet</HOTEL_REMARK>
</HOTEL>
</FTSXML_FAHR>
ปกติผมใช้ PHP รับด้วยตัวแปร ดังนี้
Code (PHP)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.xxx.travel/xml/xml_search.php");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "xml_rate=".urlencode($xml_rates));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
//$arr = simplexml_load_string($result);
//print_r($arr);
//break;
$xml_data = simplexml_load_string($result);
foreach($xml_data->HOTEL as $Type) {
$SEQNO = $Type->SEQNO[0];
$GRADE = $Type->GRADE[0];
$ADDRESS = $Type->ADDRESS[0];
$HOTELID = $Type->HOTELID[0];
$HOTELNAME = $Type->HOTELNAME[0];
$COUNTRY_ID = $Type->COUNTRY_ID[0];
$CITY = $Type->CITY[0];
$CHECK_IN_DATE = $Type->CHECK_IN_DATE[0];
$CHECK_OUT_DATE = $Type->CHECK_OUT_DATE[0];
$CANCEL_DUE_DATE1 = $Type->CANCELLATION_POLICY->CHARGE1->CANCEL_DUE_DATE[0];
$CANCEL_NIGHT_CHARGE1 = $Type->CANCELLATION_POLICY->CHARGE1->CANCEL_NIGHT_CHARGE[0];
$CANCEL_DUE_DATE2 = $Type->CANCELLATION_POLICY->CHARGE2->CANCEL_DUE_DATE[0];
$CANCEL_NIGHT_CHARGE2 = $Type->CANCELLATION_POLICY->CHARGE2->CANCEL_NIGHT_CHARGE[0];
$CANCEL_DUE_DATE3 = $Type->CANCELLATION_POLICY->CHARGE3->CANCEL_DUE_DATE[0];
$CANCEL_NIGHT_CHARGE3 = $Type->CANCELLATION_POLICY->CHARGE3->CANCEL_NIGHT_CHARGE[0];
$CANCEL_DUE_DATE4 = $Type->CANCELLATION_POLICY->CHARGE4->CANCEL_DUE_DATE[0];
$CANCEL_NIGHT_CHARGE4 = $Type->CANCELLATION_POLICY->CHARGE4->CANCEL_NIGHT_CHARGE[0];
$HOTEL_REMARK = $Type->HOTEL_REMARK[0];
$SUBSERVICE = $Type->SUBSERVICE[0];
echo "<BR><BR>";
echo "SEQNO : ".$SEQNO."<BR>";
echo "GRADE : ".$GRADE."<BR>";
echo "ADDRESS : ".$ADDRESS."<BR>";
echo "HOTELID : ".$HOTELID."<BR>";
echo "HOTELNAME : ".$HOTELNAME."<BR>";
echo "COUNTRY_ID : ".$COUNTRY_ID."<BR>";
echo "CITY : ".$CITY."<BR>";
echo "CHECK_IN_DATE : ".$CHECK_IN_DATE."<BR>";
echo "CHECK_OUT_DATE : ".$CHECK_OUT_DATE."<BR>";
echo "CANCEL_DUE_DATE1 : ".$CANCEL_DUE_DATE1."<BR>";
echo "CANCEL_NIGHT_CHARGE1 : ".$CANCEL_NIGHT_CHARGE1."<BR>";
echo "CANCEL_DUE_DATE2 : ".$CANCEL_DUE_DATE2."<BR>";
echo "CANCEL_NIGHT_CHARGE2 : ".$CANCEL_NIGHT_CHARGE2."<BR>";
echo "CANCEL_DUE_DATE3 : ".$CANCEL_DUE_DATE3."<BR>";
echo "CANCEL_NIGHT_CHARGE3 : ".$CANCEL_NIGHT_CHARGE3."<BR>";
echo "CANCEL_DUE_DATE4 : ".$CANCEL_DUE_DATE4."<BR>";
echo "CANCEL_NIGHT_CHARGE4 : ".$CANCEL_NIGHT_CHARGE4."<BR>";
foreach($Type->ROOMINFO as $Typ) {
$ROOM_TYPE_ID = $Typ->ROOM_TYPE_ID[0];
$ROOM_CATEGORY = $Typ->ROOM_CATEGORY[0];
$ROOM_NAME = $Typ->ROOM_NAME[0];
$ROOM_AVAILABILITY = $Typ->ROOM_AVAILABILITY[0];
$BB_CODE = $Typ->BB_CODE[0];
$PRICE_PER = $Typ->PRICE_PER[0];
$PRICE_CURRENCY = $Typ->PRICE_CURRENCY[0];
$PRICE_UNIT = $Typ->PRICE_UNIT[0];
$PRICE_TOTAL = $Typ->PRICE_TOTAL[0];
echo "ROOM_TYPE_ID : ".$ROOM_TYPE_ID."<BR>";
echo "ROOM_CATEGORY : ".$ROOM_CATEGORY."<BR>";
echo "ROOM_NAME : ".$ROOM_NAME."<BR>";
echo "ROOM_AVAILABILITY : ".$ROOM_AVAILABILITY."<BR>";
echo "BB_CODE : ".$BB_CODE."<BR>";
echo "PRICE_PER : ".$PRICE_PER."<BR>";
echo "PRICE_CURRENCY : ".$PRICE_CURRENCY."<BR>";
echo "PRICE_UNIT : ".$PRICE_UNIT."<BR>";
echo "PRICE_TOTAL : ".$PRICE_TOTAL."<BR>";
}
echo "HOTEL_REMARK : ".$HOTEL_REMARK."<BR>";
echo "SUBSERVICE : ".$SUBSERVICE."<BR>";
}
อ่ะครับพี่ ถ้าสังเกตุให้ดีดี ใน Tag ของ Hotel จะสามารถมี ROOMINFO ได้ 1 - 3 อันเลยอ่ะครับ เลยอยากจะได้วิธีแปลง XML ดังกล่างให้เหมือนกับฟังชั่นของ PHP เลยน่ะครับ ผมลองหาแล้ว ส่วนใหญ่มันจะแสดง ค่า XML มาทั้งหมดเลยอ่ะคัรบ ผมไม่รู้จะเขียนในลักษณะ PHP อย่างไร เผอิญผมไม่มีประสบการณ์เขียน VB.NET อ่ะคัรบ
Date :
2014-05-19 18:06:36
By :
nut_ch31
ทำได้แล้วครับ ขอบคุณ พี่แอดมินมากมาย :-3
Date :
2014-05-20 16:26:10
By :
nut_ch31
Date :
2014-05-20 16:28:18
By :
mr.win
Load balance : Server 03