WordPress.org

Ready to get started?Download WordPress

Forums

add http headers (1 post)

  1. Demetrius Pop
    Member
    Posted 7 months ago #

    Hi,

    Do I need to add header("Content-type: text/xml");to my script or somewhere in my site in order to parse XML? If so, how do I go about doing that?

    code snippet that requires the header:

    header("Content-type: text/xml");
    
    $dom = new DOMDocument("1.0");
    $node = $dom->createElement($wpdb->prefix.'address_table');
    $parnode = $dom->appendChild($node); 
    
     $node = $dom->createElement("marker");
    		  $newnode = $parnode->appendChild($node);
    		  $newnode->setAttribute("lat",$data->results[0]->geometry->location->lat);
    		  $newnode->setAttribute("lng", $data->results[0]->geometry->location->lng); 
    
    echo $dom->saveXML();

    This is the error I get:
    error on line 7 at column 45: Entity 'raquo' not defined

Reply

You must log in to post.

About this Topic