D
D
dimonfreeman2019-09-12 17:38:42
PHP
dimonfreeman, 2019-09-12 17:38:42

Import from php to xml?

I can't add gurl and gname nested in item each... Tell me
how to add.

header("Content-type: text/xml; charset=utf-8");
    $dom = new DOMDocument('1.0','utf-8');
    $root = $dom->createElement('rss');
    $dom->appendChild($root);


    $title = $dom->createElement('title', 'test');
    $root->appendChild($title );

    $link = $dom->createElement('link', 'test');
    $root->appendChild($link );

    $description = $dom->createElement('description', 'test');
    $root->appendChild($description );



while($arElement = $rsElements->GetNext())
{
    $url =$dom->createElement("gurl", $surl.$arElement[DETAIL_PAGE_URL]);
    $root->appendChild($url );

    $name = $dom->createElement("gname", $arElement[NAME]);
    $root->appendChild($name );

}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question