connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } if (mysqli_connect_error()) { die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } echo 'Success... ' . $mysqli->host_info . "\n"; $to_export = array(); if ($result = $mysqli->query("SELECT * FROM node")) { while ($row = $result->fetch_assoc()) { $to_export[$row['nid']] = $row; $to_export[$row['nid']]['created_at'] = strftime("%Y-%m-%d %T %z", $row['created']); } } # get their URLs and map to a filename if ($result = $mysqli->query("SELECT * FROM url_alias")) { while ($row = $result->fetch_assoc()) { $matches = array(); if (preg_match('/node\/(\d+)/', $row['src'], $matches)) { if ($to_export[$matches[1]]) { $to_export[$matches[1]]['path'] = $row['dst']; } } } } foreach ($to_export as $post) { $vid = $post['vid']; if ($result = $mysqli->query("SELECT * FROM node_revisions WHERE vid = $vid")) { while ($row = $result->fetch_assoc()) { $to_export[$row['nid']]['body'] = $row['body']; } } } foreach ($to_export as $post) { if (array_key_exists('path', $post)) { $title = $post['title']; $created_at = $post['created_at']; $body = $post['body']; $the_post = <<close(); ?>