Hallo,
ich versuche gerade den Wordpress export per Java zu starten. Jedoch bekomme ich immer die Folgende Meldung in meine XML Datei geschrieben:
Ich habe dazu folgenden Code verwendet um die Wordpress zu exportieren:
Hat jemand schonmal Wordpress exportiert per Java, wenn ja, wie geht das?
Als Hintergrund. Ich schreibe einen Client, der das zentrale Blog auch lokal (ohne Internetanbindung) anzeigen soll
Gruß
Andreas
ich versuche gerade den Wordpress export per Java zu starten. Jedoch bekomme ich immer die Folgende Meldung in meine XML Datei geschrieben:
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE">
<head>
<title>&Firma BLOG › Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel='stylesheet' href='http://&URL/blog/wp-admin/css/login.css?version=2.5.1' type='text/css' />
<link rel='stylesheet' href='http://&URL/blog/wp-admin/css/colors-fresh.css?version=2.5.1' type='text/css' />
<script type="text/javascript">
function focusit() {
document.getElementById('user_login').focus();
}
window.onload = focusit;
</script>
</head>
<body class="login">
<div id="login"><h1><a href="http://wordpress.org/" title="Powered by WordPress">&Firma BLOG</a></h1>
<form name="loginform" id="loginform" action="wp-login.php" method="post">
<p>
<label>Username<br />
<input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="10" /></label>
</p>
<p>
<label>Password<br />
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
</p>
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> Remember Me</label></p>
<p class="submit">
<input type="submit" name="wp-submit" id="wp-submit" value="Log In" tabindex="100" />
<input type="hidden" name="redirect_to" value="/blog/wp-admin/export.php?download" />
<input type="hidden" name="testcookie" value="1" />
</p>
</form>
<p id="nav">
<a href="http://&URL/blog/wp-login.php?action=register">Register</a> |
<a href="http://&URL/blog/wp-login.php?action=lostpassword" title="Password Lost and Found">Lost your password?</a>
</p>
</div>
<p id="backtoblog"><a href="http://&URL/blog/" title="Are you lost?">« Back to &Firma BLOG</a></p>
</body>
</html>
Java:
public class Test {
public static void download(String address, String localFileName) {
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
try {
URL url = new URL(address);
out = new BufferedOutputStream(
new FileOutputStream(localFileName));
conn = url.openConnection();
in = conn.getInputStream();
byte[] buffer = new byte[1024];
int numRead;
long numWritten = 0;
while ((numRead = in.read(buffer)) != -1) {
out.write(buffer, 0, numRead);
numWritten += numRead;
}
System.out.println(localFileName + "\t" + numWritten);
} catch (Exception exception) {
exception.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (IOException ioe) {
}
}
}
public static void download(String address) {
int lastSlashIndex = address.lastIndexOf('/');
if (lastSlashIndex >= 0 &&
lastSlashIndex < address.length() - 1) {
download(address, address.substring(lastSlashIndex + 1));
} else {
System.err.println("Could not figure out local file name for " +
address);
}
}
public static void main(String[] args) {
download("http://&URL/blog/wp-admin/export.php?download","./test.xml");
}
}
Hat jemand schonmal Wordpress exportiert per Java, wenn ja, wie geht das?
Als Hintergrund. Ich schreibe einen Client, der das zentrale Blog auch lokal (ohne Internetanbindung) anzeigen soll
Gruß
Andreas
Zuletzt bearbeitet von einem Moderator: