Today I developed this tool to import wordpress blog rolls as XML document. You know when you export data from wordpress.com that doesn’t include the blog rolls data. So if you want to keep a backup of your blog rolls, you can use this tool to import your blog rolls data.. This one is developed using PHP and Curl
You can doewnload it and see the code in action here
Opensource WordPress Blogrolls Importer
################
The trick is lying here —
;
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, “./login.jar”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line makes it work under https
curl_setopt($ch, CURLOPT_URL,“{$url}/wp-login.php”);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, “log={$username}&pwd={$password}&&redirect_to=wp-admin/link-manager.php&wp_submit=”);
$buffer= curl_exec ($ch); // execute the curl command
Why anyone wants to do that? I mean why this is useful? If I take my whole blog somewhere else, I’ll get this too. Isn’t it?
Nope
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
——————————————————————————–
XML document must have a top level element. Error processing resource ‘http://localhost/blogrollimporter/blogrollsimporter….
I found the solution. The Problem was in line 33
if ($jobstart===false) break; //quit if there is no more blogrolls
which should be :
if ($jobstart==false) break; //quit if there is no more blogrolls