Извлечение XML-канала в PHP для вставки в базу данных MYSQL

Если я пытаюсь вставить все в базу данных, все работает, только то, что не работает, это содержимое: закодировано, потому что оно: закодировано, я хочу правильно вставить все данные в те поля, которые у меня есть в настоящее время. Данные XML — это новостные статьи, которые мне нужно вставить в новую базу данных.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.azned.nl/feed.xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$indexFeed = simplexml_load_string($response);
$indexFeed = str_replace("<content:encoded>","<contentEncoded>", $response);
$indexFeed = str_replace("</content:encoded>","</contentEncoded>", $response);
foreach($x->channel->item as $entry) {

$obj = $modx->newObject('modResource', array(
'pagetitle'             => $entry->pagetitle,
'description'           => $entry->description,
'content'               => $entry->contentEncoded,
'type'                  => 'document',
'longtitle'             => $entry->longtitle,
'link'                  => $entry->link,
'published'             => 1,
'pub_date'              => 0,
'alias'                 => $entry->pagetitle, $entry->longtitle,
'parent'                => 2,
'folder'                => 0,
'richtext'              => 1,
'template'              => 2,
'menuindex'             => 3,
'searchable'            => 1,
'cacheable'             => 1,
'createdby'             => 6,
'editedon'              => 6,
'editedby'              => 6,
'deleted'               => 0,
'deletedon'             => 0,
'deletedby'             => 0,
'publishedby'           => 6,
'donthit'               => 0,
'privateweb'            => 0,
'privatemgr'            => 0,
'content_dispo'         => 0,
'hidemnu'               => 0,
'class_key'             => 'Article',
'context_key'           => 'web',
'content_type'          => 1,
'uri_override'          => 1,
'hide_children_in_tree' => 0,
'show_in_tree'          => 0,
'properties'            => 'Properties'
));

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector