• I’m trying to import a wordpress.com export xml file into a local install of www.ads-software.com

    When the import gets to an attachment, it always throws this error:
    Importing attachment Remote file error: Remote server did not respond

    But when I try to directly access the file, it works fine

    I’m guessing the import times out trying to reach the wordpress.com server to download the file? I’ve tried changing all the timeout variables for php.ini, htaccess, import/wordpress.php and even gone into the core where timeouts are defined like in functions.php and http.php but still not having any luck with this, the importer waits for a second then throws this error and moves onto the next file

    it’s been suggested to me at this thread https://www.rangerpretzel.com/index.php?option=com_content&task=view&id=20&Itemid=19#josc44 that i download all the images to a local folder but i’m not sure how to download a batch list of image urls?

    If anyone can help at all it’s really appreciated, we’ve been trying to get this import working correctly for a few weeks now!

    thank you!

Viewing 1 replies (of 1 total)
  • In case you haven’t got this solved, here’s how I did it (lazy unix way, but worked):-

    1. Get the list of attachment URLs from the xml file (exported from wordpress.com), into a file ready to be wget-ed:-
    # grep 'attachment_url' wp-exported.xml | sed 's/<wp:attachment_url>//g;s/<\/wp:attachment_url>//g' > attachments.txt

    2. Prepare a temporary directory on any web-reachable + shell accessible space (such as your target wordpress site):-
    # cd /home/wordpress/public_html; mkdir attachments

    3. Download all attachments from wordpress.com to the temporary directory using wget (list of URLs in attachments.txt):-
    # cd attachments; wget -t 0 -c -i attachments.txt

    4. Edit the xml file exported from wordpress.com, and do a global search and replace for the old files.wordpress.com URL, replacing it with your temporary folder:-
    # vim wp-exported.xml
    :%s/<wp:attachment_url>http:\/\/oldblog.wordpress.com\/[0-9]*\/[0-9]*/<wp:attachment_url>http:\/\/newblog.com\/attachments/g
    :wq

    5. At your new wordpress site, re-import using the newly edited wp-exported.xml file. The import script should download the files off of your temporary directory without any ‘not respond’ errors.

    6. In my case however, after successful import, in the new blog site, each post still loads images from the old wordpress.com blog. So I had to dump the local wordpress db, edit it, and do the following search replace commands:-
    # mysqldump --databases newblog > newblog.sql
    # vim newblog.sql
    :%s/oldblog.wordpress.com\/[0-9]*\/[0-9]*/newblog.com\/wp-content\/uploads\/2010\/04/g
    (Note that the last 2 numbers must be the year and month when your import was done i.e. current year & month).

    7. [You might not need to do this] In my wordpress.com site I had adjusted the medium size image setting (Settings -> Media) to 500×500, so I had to adjust the link in the new site to match the actual file name (since w=500 no longer works in the new site):-
    :%s/\.jpg?w=500/-500x375.jpg/g
    :wq
    (If you need to do this, you need to peek inside your new site’s uploads directory to see the file name patterns and adjust the above command accordingly).

    8. Reimport the modified SQL file:-
    # mysql < newblog.sql

    These are far from efficient (there must be a better way), but it worked for me, without dabbling with wordpress code.

    Hope this helps! ??

Viewing 1 replies (of 1 total)
  • The topic ‘Importing attachment Remote file error: Remote server did not respond’ is closed to new replies.