This page is outdated. Please click here for the update. Comments are closed on this post.
As I have not heard anything about the solution to this problem, I wrote a script. This script is a simple but powerful π script which extracts the posts and comments from RSS feeds at blogger.com.
Instructions:
Copy the script to your main WordPress directory and run it (http://your.name/blogger-beta-import.php). The options are self-explanatory. This means you can customize the category and user before importing.
Warning:
This script represents a security hazard if left on the server. Once you are finished, delete it. Don’t even rename or save a copy on the server. The script does not honor WordPress authentication and checks, but utilizes some of WordPress’ functions.
Limitations:
- No handling of images (stay on blogger server)
- Comments will have the names but not email or URL – limitation with RSS from Blogger
- Unlikely to work if you use other comment systems
- You need to enable RSS feed for comments – very important!
As for images, they will stay in blogger.com but I suggest you download them at once to your server as Blogger does not allow hot-linking (images will be blocked). You don’t have to do it one by one, you can use this plugin by Notions: Blogger Image Import. I’ve tried it and it worked well. One thing is that it depends on CURL to download images – servers without this extension will not execute the script. Let me know as I have a workaround for this, provided that your PHP version is later than 4.3.0.
Please don’t look at the code as it is written in 2 hours without so many cosmetic or improvements in efficiency. This script will work on existing WordPress installations but due to some assumptions made, it may break certain things like post counts for categories, etc. I suggest use it only on a virgin WordPress installation. However, I’ve tried it to import several different blogs and the result is awesome – it looks like multi-user blog π
This code will be short-lived, I think as Blogger is finalizing their system out of Beta. One little change on their system would mean disaster for this script, and I am not sure I will have the time to give any kind of support. So, be quick and import now, while the script still works!
I have not tested this script with blogs larger than 300, if you encounter problems do let me know, maybe we can split executions.
Download the script here:
blogger-beta-import.zip (2.81KB)
blogger-beta-import-0.2.zip (3.64KB)
blogger-beta-import-0.3.zip (3.69KB)
blogger-beta-import-0.4.zip (4.86KB)
blogger-beta-import-0.5.zip (4.94KB)
Changelog:
2006-12-22:
- Added ability to add commentor URL and email since these data can’t be obtained from RSS.
- Added extra checks to terminate script if something fails. No use wasting user time to wait for a broken result.
2007-01-01:
- Bugfix: When a comment author’s name contains apostrophes it will fail to be loaded into the database. Update 0.3 fixed that – thanks to Dawn.
2007-01-11:
- Added automated checking for feed retrieval mechanism (fopen or curl). If both are not available, the script will tell you and not run π
- Added code for retrieval using curl.
- Added ability to make step by step imports – useful for people having bandwidth or server speed problems. Requested by Dawn.
- This script has only been tested in few sites, so if you encounter any problems do let me know.
2007-01-14:
- Bugfix: First import does not work, page have to be refreshed to make it work – thanks to Jonas.
I suggest you download the script only from this site, especially if you’re not a programmer as PHP codes are easily modifiable for malicious intent.
I will not be liable for any problems you might have with your WordPress installation. Use this script at your own risk.
Comments are welcome but I may take some time to respond as my time is limited.
How to make sure full feeds are available:
Switch to Advanced Mode and make sure your settings are like this:
Special Notes:
Thanks to Charles Wesley for his suggestions on using the CURL library.
Tested On WordPress versions:
- 2.0.5 – Working.
- 2.0.6 – Working.
- 2.0.7 – Working.
- 2.1 – Working. Thanks to Ricardo
TODO:
Import by a number of posts at a time (staged import)– done- Haloscan import support
- Mapping of categories from blogger
- Mapping of authors from blogger
- As a plugin
- Include an option to import all posts without staging
- Maintain permalinks from blogger
@Dawn: Please send it to adyromantika at gmail dot com
hi, i was trying your blogger beta importer but i get the folowwing error.
Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /www/110mb.com/r/i/c/a/r/d/o/_/ricardo/htdocs/blogger-beta-import.php on line 158
Warning: fopen(http://ricardo.beijos.blogspot.com/feeds/posts/full?alt=rss&max-results=1&start-index=200000) [function.fopen]: failed to open stream: no suitable wrapper could be found in /www/110mb.com/r/i/c/a/r/d/o/_/ricardo/htdocs/blogger-beta-import.php on line 158
Warning: fread(): supplied argument is not a valid stream resource in /www/110mb.com/r/i/c/a/r/d/o/_/ricardo/htdocs/blogger-beta-import.php on line 159
Warning: fclose(): supplied argument is not a valid stream resource in /www/110mb.com/r/i/c/a/r/d/o/_/ricardo/htdocs/blogger-beta-import.php on line 160
any ideas on what i shouldo?
Thanks
@ricardo: Your server has allow_url_fopen set to off meaning that scripts will not be able to open URLs.
You can ask you server provider to set
allow_url_fopen = On
Or you can try adding this to the start of the script, it might work depending on the server config:
ini_set ('allow_url_fopen','On');
In the end server configuration always matters so you’re out of luck if the server provider is paranoid.
It’s me again, Ady.
I have a question. Does the script grab posts/comments in a particular order (oldest to newest, newest to oldest, etc.) or does it grab at random?
Dawn
@Dawn: The script downloads the feeds in as it is – newest to oldest. It gathers all data and then insert the posts & comments the reverse order – oldest then newest. This is to make sure that on the post management screen, newer posts gets listed first as it is sorted by post ID.
Okay, so does that mean when the script runs only partially and grabs say 180 out of 300 posts that I will get the newest or oldest posts imported?
Dawn
@Dawn: If the problem is due to timeout when getting the feeds, then no post will be inserted into the database. If something gets inserted – the script died while inserting. Whether or not error messages are displayed on screen depends on the display_errors settings on the server. If some posts gets imported, I strongly think that the script died because of the max_execution_time settings on the server which is not impossible on a slow (as in specs, not traffic) server.
Directly answering your question – older posts & comments gets inserted first.
@ricardo: Your server has allow_url_fopen set to off meaning that scripts will not be able to open URLs.
You can ask you server provider to set allow_url_fopen = On
Or you can try adding this to the start of the script, it might work depending on the server config:
ini_set (‘allow_url_fopen’,’On’);
In the end server configuration always matters so youβre out of luck if the server provider is paranoid.
do u mean in the very first line? i did put that bit of code in the first line in there but didnt work aswell
i also noticed i couldnt open this link that pops in the error message, could it be that aswell
http://ricardo.beijos.blogspot.com/feeds/posts/full?alt=rss&max-results=1&start-index=200000
@ricardo: The error URL file-access is disabled in the server clearly defines that the server configuration is denying the script access to URLs even if the URL is correct. So runtime configuration is also not allowed.
The URL you specified is weird. It should be the XXXXXX in XXXXXX.blogspot.com
Are you sure the URL ricardo.beijos.blogspot.com is correct? I don’t think so. But that’s the least of your problem, please consult server provider on the first problem first.
Good luck and let me know if you got stuck anywhere.
sorry, youre right that was the url for something else lol, sorry
the following error appears when i try to import the images using the images import plugin but get the following error:
**** POST 39 ****
Fatal error: Call to undefined function curl_init() in /home/filercom/public_html/ric/teste/wp-content/plugins/blogger-image-import.php on line 127
i know youre not the author but ….. can you help?
@ricardo: If your PHP version is equal or greater than 4.3.0 you can use this modified script. Replace the original blogger image import file.
https://blog.adyromantika.com/scripts/blogger-image-import.zip
just to let u know that it worked, some of them didnt work as i had quite a few with the lightbox tag in it, so i think it wwas because of it,
once again thanks for your help!
@ricardo: No problem. Your last comment was for the image import right?
I hope all of the post/comment import was successful.
This was a huge help. Thank you. New Blogger was killing me.
Thank you so much, worked really well for over 500 posts.
I’m running the script, then after a few seconds a dialogue box opens saying “You have chosen to open blogger-beta-import.php” and asking if I want to open it or not. The script appears to stop running at that point, with the import incomplete. Is there any way to stop this happening?
Also – with apologies for double-posting – is there any way to import Haloscan comments using this?
I’ve been publishing with Blogger by SFTP for years and just made the switch to WordPress a few days ago. To make use of your import script I tranferred my blog to a Blogspot account and set the feeds to full. Tried out your script after that but it appears not to work for me, today, January 3rd. There were no error messages, however, I noticed the script did not register the Blogger ID or number of posts I have over 900 posts. Thanks for all your work.
Hi Ady,
My blog was hosted on my own server and not blogspot. I guess this is the reason that I cannot get the importer to work. Any ideas about how to rectify this?
@Melissa: Great! I am happy it helped.
@John H: Please email me your blogger URL and the current URL where you want to import it to. I won’t run the script, just want to diagnose your server a bit no harm will be done. As for Haloscan, maybe code change needs to be done.
@mutant: I need the same things from you as what I need from John H.
@Liana: I think you need to republish all of your posts to blogspot. However to be safe send me your source and destination URL so that I can have a look and give suggestions.
@All: Email me at adyromantika at gmail dot com or ady at romantika dot name. I am currently very busy with a dev work and audit at my dayjob so I’ll try my best to help.
I chose the simple solution. I published via blogspot and now it is importing nicely. Thank you!
@John H, mutant:
As I explained in my email the problem you are facing might be caused by the max_execution_time setting on the destination server.
For mutant, the problem is also caused by the allow_url_fopen setting.
As I mentioned to Dawn, I am planning to have the script to import in stages but due to current workload I can’t promise when…
Do keep an eye on this page, if I have any updates!