Autor |
Nachricht |
epp_b
Anmeldedatum: 04.06.2012
Beiträge: 19
|
Verfasst am:
Di Jun 19, 2012 22:06 |
  |
I've written a script that converts the CSV file of call logs exported from MyPhoneExplorer to an XML file that can be used with Call Logs Backup & Restore to restore all your call history to an Android phone if you've upgraded the OS (and it deleted your call history) or need to get your call logs from your old Android phone to your new one.
It's a PHP script that needs a web server to run. You can try it here, but I'm not going to leave it up permanently. I've tested it with Android 2.3.4 (upgraded from 2.1) on a Linux/Apache environment, but that's it. It should work in other environments, but I can't make any guarantees.
Does FJ software want a copy to host it themselves? |
|
|
  |
 |
epp_b
Anmeldedatum: 04.06.2012
Beiträge: 19
|
Verfasst am:
Mi Jun 20, 2012 14:37 |
  |
Correction: Android 2.3.7 (Cyanogenmod 7.1.0) |
|
|
  |
 |
FJ
Site Admin
Anmeldedatum: 15.02.2006
Beiträge: 31906
Wohnort: Tirol
|
Verfasst am:
Mi Jun 27, 2012 01:24 |
  |
Many thanks, i will host it but i'll need the source file, please send it to me zipped via email |
_________________ Ich bitte um Verständnis daß ich aufgrund des hohen Aufkommens im Forum und meines zeitlichen Rahmens nichtmehr jeden Thread im Forum persönlich lesen bzw. beantworten kann.
Bitte benutzt auch die Forum-Suche bzw. die FAQ |
|
    |
 |
epp_b
Anmeldedatum: 04.06.2012
Beiträge: 19
|
Verfasst am:
Do Jun 28, 2012 17:25 |
  |
Actually, it's a very short file, I'll just post the code here:
Code: | <?php
// CSV to XML converter for MyPhoneExplorer
// Public domain: use, reuse, peruse and abuse :)
// file uploaded
if (count($_FILES)) {
// open uploaded file for reading
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
// iterator
$i = 0;
// init output var
$xmlout = array();
// call type (Storage)
$CallTypes = array('DC', 'RC', 'MC');
// loop through CSV data
while ($csvline = fgetcsv($f, 1024, ',', '"')) {
// first line, get headings
if ($i == 0) {
$headings = $csvline;
$i++;
continue;
}
// populate data from headings
foreach ($headings AS $j => $heading)
${$heading} = $csvline[$j];
// generate UNIX timestamp from standard timestamp
list($stampdate, $stamptime) = explode(' ', $Time);
list($yr,$mo,$da) = explode('-', $stampdate);
list($hr,$mn,$sc) = explode(':', $stamptime);
// OUTPUT
$xmlout[] = " <call number=\"$Number\" duration=\"$Duration\" date=\"" . mktime($hr,$mn,$sc,$mo,$da,$yr) . "000\" type=\"" . (array_search($Storage, $CallTypes)+1) . "\" />";
$i++;
}
// file population of data
$xml_start = '<' . "?xml version='1.0' encoding='UTF-8' standalone='yes' ?" . ">\r\n<calls count=\"" . count($xmlout) . "\">\r\n";
$xml_end = "\r\n</calls>";
// output as XML file to save
header('Content-Type: text/xml');
header('Content-Disposition: attachment; Filename="calls-restored.xml"');
echo $xml_start . implode("\r\n", $xmlout) . $xml_end;
exit;
}
// Output upload form...
?>
<div align="center" style="margin-top: 25px">
<div style="font-size: 20px">CSV to XML converter for MyPhoneExplorer / Android Call Log</div>
<div style="padding: 25px; text-align: center; width: 600px; border: 1px dotted #000000; margin-top: 5px">
<form name="csv2xml" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" style="margin: 0px" enctype="multipart/form-data">
CSV file from MyPhoneExplorer: <input type="file" name="csvfile">
<input type="submit" value="convert" style="font-weight: bold">
</form>
</div>
</div> |
Copy and save as .php file. Make sure your php.ini file is configured accept file uploads. |
Zuletzt bearbeitet von epp_b am Mi Feb 06, 2013 08:04, insgesamt einmal bearbeitet |
|
  |
 |
ajeet
Anmeldedatum: 09.03.2011
Beiträge: 4
|
Verfasst am:
Do Jul 05, 2012 11:42 |
  |
I tried this utility to generate the xml file. However, there are some errors . The contents cannot be viewed using CallLogBackup&Restore. The dates and time seem incorrect and there is no duration. |
|
|
  |
 |
markfitz
Anmeldedatum: 06.07.2012
Beiträge: 1
|
Verfasst am:
Fr Jul 06, 2012 11:59 |
  |
Hi Firstly thanks heaps for the great amazing wonderful software it rocks................I havea samsung galaxy 2 and i dropped it and got a new one, when I sync up it synced with my outlook prefectly however I cannot work out how to sync my sms and calls ...is this possible????
Cheers Mark |
|
|
  |
 |
FJ
Site Admin
Anmeldedatum: 15.02.2006
Beiträge: 31906
Wohnort: Tirol
|
Verfasst am:
So Jul 08, 2012 00:25 |
  |
@epp_b: Many thanks again, its hosted now on my site, you can delete your converter.
@ajeet: Please try the hosted version on my site, since CSV-Files are language specific i had to adapt some things so the right format gets autodetected.
Convert exported call list from MyPhoneExplorer to XML-File for Call Logs Backup & Restore
@mark: For SMS you should use Menu-Extras-Create backup/Restore backup. For calls its currently not implemented but you can use the workaround which is handled in this thread |
_________________ Ich bitte um Verständnis daß ich aufgrund des hohen Aufkommens im Forum und meines zeitlichen Rahmens nichtmehr jeden Thread im Forum persönlich lesen bzw. beantworten kann.
Bitte benutzt auch die Forum-Suche bzw. die FAQ |
|
    |
 |
ajeet
Anmeldedatum: 09.03.2011
Beiträge: 4
|
Verfasst am:
So Jul 08, 2012 08:48 |
  |
Hi FJ, I tried the version on your site but it too does not show the date, time and duration correctly. Perhaps I will send you the calls dat and the corresponding CSV file created. You could maybe look into.
Cheers. |
|
|
  |
 |
FJ
Site Admin
Anmeldedatum: 15.02.2006
Beiträge: 31906
Wohnort: Tirol
|
Verfasst am:
So Jul 22, 2012 00:00 |
  |
Now near all problems has been fixed. I think now its a acceptable workaround |
_________________ Ich bitte um Verständnis daß ich aufgrund des hohen Aufkommens im Forum und meines zeitlichen Rahmens nichtmehr jeden Thread im Forum persönlich lesen bzw. beantworten kann.
Bitte benutzt auch die Forum-Suche bzw. die FAQ |
|
    |
 |
epp_b
Anmeldedatum: 04.06.2012
Beiträge: 19
|
Verfasst am:
Do Jul 26, 2012 07:35 |
  |
Zitat: | I tried this utility to generate the xml file. However, there are some errors . The contents cannot be viewed using CallLogBackup&Restore. The dates and time seem incorrect and there is no duration. |
Hmm, I didn't actually try to view the log on my phone, I just restored it and it worked. Has this been fixed by FJ already?
Zitat: | @ajeet: Please try the hosted version on my site, since CSV-Files are language specific i had to adapt some things so the right format gets autodetected. |
Yup, sorry, I should have said that it was English-only (sorry, I only know very little German )
Zitat: | Hi Firstly thanks heaps for the great amazing wonderful software it rocks................I havea samsung galaxy 2 and i dropped it and got a new one, when I sync up it synced with my outlook prefectly however I cannot work out how to sync my sms and calls ...is this possible???? |
The SMS file will use different variables and formatting, so the script would need to be updated to handle that.
However, as MPE can restore SMS to the phone, this would be redundant.
Zitat: | Hi FJ, I tried the version on your site but it too does not show the date, time and duration correctly. Perhaps I will send you the calls dat and the corresponding CSV file created. You could maybe look into.
Cheers. |
Maybe post a sample of the CSV file with the names/numbers changed so we can see what it looks like? |
|
|
  |
 |
FJ
Site Admin
Anmeldedatum: 15.02.2006
Beiträge: 31906
Wohnort: Tirol
|
Verfasst am:
Mo Jul 30, 2012 23:47 |
  |
MyPhoneExplorer can already upload messages from SMS-Archive to the phone so no need to create another script |
_________________ Ich bitte um Verständnis daß ich aufgrund des hohen Aufkommens im Forum und meines zeitlichen Rahmens nichtmehr jeden Thread im Forum persönlich lesen bzw. beantworten kann.
Bitte benutzt auch die Forum-Suche bzw. die FAQ |
|
    |
 |
epp_b
Anmeldedatum: 04.06.2012
Beiträge: 19
|
Verfasst am:
Mi Aug 01, 2012 18:13 |
  |
Zitat: | MyPhoneExplorer can already upload messages from SMS-Archive to the phone so no need to create another script |
True, although it takes a really long time if you've got a lot of messages. SMS B&R is quite a bit faster, so there may be some utility in having an conversion script for SMS. |
|
|
  |
 |
Yanbi
Anmeldedatum: 22.12.2012
Beiträge: 2
Wohnort: Vannes France
|
Verfasst am:
Sa Dez 22, 2012 19:00 |
  |
|
  |
 |
epp_b
Anmeldedatum: 04.06.2012
Beiträge: 19
|
Verfasst am:
Fr Apr 26, 2013 04:31 |
  |
Just to update: I just ran a file through this script on FJ's server and restored the file successfully with CLB&R on the very latest version of Android  |
|
|
  |
 |
taloncc
Anmeldedatum: 11.10.2015
Beiträge: 1
|
Verfasst am:
So Okt 11, 2015 04:23 |
  |
I just tried to use this and had all kinds of errors. I had to adjust for date/time format of USA.
here are my mods.
This one is meant to be run at the command line with your file named export.csv.
ie php export.csv > exportoutput.xml
Code: |
<?php
// CSV to XML converter for MyPhoneExplorer
// Public domain: use, reuse, peruse and abuse :)
date_default_timezone_set('America/Chicago');
$file = "export.csv";
// open uploaded file for reading
$f = fopen($file, 'r');
// iterator
$i = 0;
// init output var
$xmlout = array();
// call type (Storage)
$CallTypes = array('DC', 'RC', 'MC');
// loop through CSV data
while ($csvline = fgetcsv($f, 1024, ',', '"')) {
// first line, get headings
if ($i == 0) {
$headings = $csvline;
$i++;
continue;
}
// populate data from headings
foreach ($headings AS $j => $heading)
${$heading} = $csvline[$j];
// generate UNIX timestamp from standard timestamp
list($stampdate, $stamptime, $am) = explode(' ', $Time);
$stamptime = $stamptime . " " . $am;
//echo "\n" . $stamptime . " - ";
$stamptime = date("H:i", strtotime($stamptime));
//echo $stamptime . "\n";
list($mo,$da,$yr) = explode('/', $stampdate);
//echo $mo . "-" . $da . "-" . $yr . "\n";
list($hr,$mn,$sc) = explode(':', $stamptime);
//echo $hr . "-" . $mn . "-" . $sc. "\n";
$sc = "00";
// OUTPUT
$xmlout[] = " <call number=\"$Number\" duration=\"$Duration\" date=\"" . mktime($hr,$mn,$sc,$mo,$da,$yr) . "000\" type=\"" . (array_search($Storage, $CallTypes)+1) . "\" />";
$i++;
}
// file population of data
$xml_start = '<' . "?xml version='1.0' encoding='UTF-8' standalone='yes' ?" . ">\r\n<calls count=\"" . count($xmlout) . "\">\r\n";
$xml_end = "\r\n</calls>";
// output as XML file to save
header('Content-Type: text/xml');
header('Content-Disposition: attachment; Filename="calls-restored.xml"');
echo $xml_start . implode("\r\n", $xmlout) . $xml_end;
exit;
// Output upload form...
?>
|
|
|
|
  |
 |
|