prob!em with sending xml (declaration xml) with php -


My question really

what type of structure should I use as part of an XML If I have the highest share of logic in the class, I call the class above the call / my PHP index page, if it becomes clear that a service is being requested.

Has anyone told me that the class method should not output anything. Then where should I output XML? Out of class

In addition to this I have a problem that the receiving end is saying that the declaration should start with the document.

The receiving end is only in these two lines of document. I do not have a code to process yet, but it already gives an error.

  & lt ;? Php $ url = 'http: //www.woonbel.nl/gps/setgpsloc'; $ Xml = simplexml_load_string (file_get_contents ($ url)); ? & Gt;  

I send XML from this class, as you can see, it could happen that something goes wrong, with some white lines or something else. Anyway, I need some advice on how to avoid error declaration and how to send XML, if I do not want to do it in any method, then it should be stored in a class variable first?

  & lt;? Php class GPS {public $ url; Public $ exam; Function __ conversion ($ url) {$ this- & gt; Url = $ url; } Function ion ($ methode_naam) {switch ($ methode_naam) {case "test": $ this- & gt; Setgpsloc (); break; Case "setgpsloc": header ('content-type: text / xml'); $ Position = 2; $ Output = "& lt ;? Xml version = \" 1.0 \ "encoding = \" utf-8 \ "? & Gt; \ n"; $ Output = "& Lt; response & gt; \ n"; $ Output = "\ T  

In this way I know that a service is requested and calls the class

   = 2) {$ controller = $ parts [0]; $ Wslijst = array ("GPS", "gebruikers"); If (in_array ($ controller, $ wslijst)) includes $ $ controller. ".php"; $ Clr = new $ controller ("test"); $ Clr- & gt; Invocation ($ parts [1]); Go out(); } // Other code below to display the normal page? & Gt;  

This is going to get the actual error

PHP Warning: simplexml_load_string () [function.simplexml-load-string]: Unit: Line 4: Analyst error: XML Declaration only allows the beginning of the document in line 4 at D: \ domain \ tsa.nl \ wwwroot \ index.php PHP Warning: simplexml_load_string () [function.simplexml-load-string]: in D: \ domain \ Tsa Line 4 PHP warning on .nl \ wwwroot \ index.php: simplexml_load_string () [function.simplexml-load-string]: ^ D: \ domain \ tsa.nl \ wwwroot \ index.php on line 4

< / Div>

This is a good Is that our problem is what I was doing. The solution was really simple, as it is expected that every page on my site requires a file with some sections that I created to parse and manage the site. Squading php tag in this file ? & Gt;

There was a place after it, as it is outside the script, it is necessary that the document was included by default on it was called. Therefore, check the end of all the files that you are included / required of my page & lt ;? Xml No announcements are now announced, this is the first thing!

This is my belief:
You can also get site link there (this is my father's band site .. lol)

Therefore, any location or Newline to & lt ;? PHP? & Gt; Check out , possibly where it is coming from (included or outside the script, the HTML document (and before you parse or execute before anything else) , When you come to include the file, then whatever you are doing it is 'first', Trimming is out of your power and position).

PS: If you Check the verifier, and then go to page And check the source code, then you will see the & lt ;? Xml announcement, my pages are parsed 100% (no PHP inside the HTML).

Expected That it helps ... Cheers! :)


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -