Need help? Check out our Support site, then

How to import a LARGE hosted wordpress into

  1. Dear all,

    My brother and I spent 12 hours working on uploading a 60 MB WML XML file from an old hosted WordPress site to Here we post the solution

    The problem: A 60 MB WML, and upload limit is 3 MB!.

    We needed to chunk our WML, so we created a nifty PHP script that makes this happen. We share the love. It will create a bunch of files called chunk_*.xml that you will need to manually upload to under Manage... Import.

    The PHP script is pasted below our signature.

    Because of memory and CPU limitations (to avoid 500-errors) run it locally either by using XAMPP on your Windows machine (Daniel's favorite), or just instaling php-cli on your beautiful Ubuntu box (Alan's favorite), and doing php index.php

    Of course, you have to name your exported xml file to: XMLFINAL.xml

    Daniel and Alan, your saviours.



    $header = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
    "<rss version=\"2.0\"

    <title>Noemí Guzik Glantz</title>
    <description>Día a día...</description>
    <pubDate>Mon, 21 Jan 2008 02:52:20 +0000</pubDate>

    $footer = "</channel></rss>";

    //load xml document
    $dom = new DomDocument();

    //create DOMXPath object
    $xpath = new Domxpath($dom);

    //$query the document
    $result = $xpath->query("//item");

    $i = 1;

    $posts = 15;

    $files_chunk = 1;

    //loop through the result (it's a NamedNodemap..)
    foreach ($result as $title) {

    echo "iterando nodo " . $i . "
    " ;
    if ($i == 1) {

    $chunkXML = new DomDocument('1.0');
    $root = $chunkXML->createElement('root');
    $root = $chunkXML->appendChild($root);

    $ni = $chunkXML->importNode($title, true);

    if ($i == $posts) {

    echo "deberia escribir file ". $files_chunk . "\n";

    //$chunkXML->save("chunk_" . $files_chunk . ".xml");
    $stringXML = $chunkXML->saveXML();

    $stringXML = str_replace("<root>", "", $stringXML);
    $stringXML = str_replace("</root>", "", $stringXML);
    $stringXML = str_replace("<?xml version=\"1.0\"?>", "", $stringXML);
    $stringXML = str_replace("<item xmlns:dc=\"\" xmlns:content=\"\" xmlns:wp=\"\">", "\n<item>", $stringXML);

    $stringXML = $header . $stringXML . $footer;

    $fh = fopen("chunk_" . $files_chunk . ".xml", 'w');
    fwrite($fh, $stringXML);

    //$chunkXML = undefined ;
    $i = 0;




  2. Wow.. interesting post! Gonna try this out!

Topic Closed

This topic has been closed to new replies.

About this Topic