php simplexml_load_string($data) problem

I am sending the Mac Address of a logger to an application connected to my mySQL database.
it appears that the "%" in the mac address is considered an invalid char. I was wondering if there is a fix to this issue.

fe80::25ea:dfaa:bdd0:32f%11  (Suppose to be)
fe80::25ea:dfaa:bdd0:32f         (What is displayed while debugging)
Who is Participating?
Ray PaseurCommented:
Line 16 appears to be invalid XML:

xml += "<macAddress>" & macAddress & "</xxxName>"

Not sure if this is related to the issue, but it appears to be odd.
Where is VB.NET involved in that?
Ray PaseurCommented:
I am not seeing a problem.
<?php // RAY_temp_prowebinteractive.php

$xml = <<<XML

$obj = simpleXML_load_string($xml);


Open in new window

Perhaps you're looking at the browser-rendered HTML?  If so, you will see the entity created by %11.  I do not know what that might encode, but I expect it is down in the control characters and possibly invisible.
prowebinteractiveincAuthor Commented:
not looking at it in a browser, the only issue would have to be in the VB.NET when POSTING
here is my code:

Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Public Class logVbUser
    Public Shared responseFromVbLogger As String
    Public Shared Sub Main(ByVal customerId As Integer, ByVal userId As Integer, ByVal pcName As String, ByVal macAddress As String)
        Dim xml As String
        xml = "logRequestMode=X&logRequestData="
        xml += "<?xml version='1.0' encoding='UTF-8'?>"
        xml += "<TranxRequest>"
        xml += "<CompanyId>" & customerId & "</CompanyId>"
        xml += "<UserId>" & userId & "</UserId>"
        xml += "<pcName>" & pcName & "</pcName>"
        xml += "<macAddress>" & macAddress & "</xxxName>"
        xml += "</TranxRequest>"

        'Form2.Label20.Text = xml
        ' Create a request using a URL that can receive a post. 
        Dim request As WebRequest = WebRequest.Create("http://" & databaseConnection.dbServer & "/includes/vbNetLogger.php")
        ' 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 = xml
        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.
        ' 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.
        responseFromVbLogger = responseFromServer
        ' Clean up the streams.
    End Sub
End Class

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.