SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 13th, 2004, 06:43 PM
Archemides Archemides is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 25 Archemides User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Archemides Send a message via AIM to Archemides Send a message via Yahoo to Archemides
PHP, Act! Contact Mgt. & Pocket Organizers

Today, my project was to get 1,300 addresses out of Act! Contact Management and into an inexpensive Sharp Electronic Organizer (which can probably hold 13,000 addresses, and runs for a long time on a single AAA battery.)

In the coming weeks, I hope to post some of what I have done in PHP to emulate the some of the functionality of Act! Contact Management.

It astounded me when my PHP MySQL system ran faster from a website, than my Act! does on a new Dell Windows XP (Home Edition).



PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<
html>
<
head>
<
title>Sharp Organizer Import from ActContact Management csv export</title>
<
meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<
meta name="generator" content="HAPedit 3.0">
</
head>
<
body bgcolor="#FFFFFF">
<?
  
// Your code here
/*
Here is the header which the Sharp Organizer exports as the first record of a csv export
Therefore, it must be the first record of a csv import file.
"Category","Last Name","First Name","Company","Home#","Office#","Fax#","Mobile#","Pager#","Address","E-mail","Note"
*/
$Header_Rec '"Category","Last Name","First Name","Company","Home#","Office#","Fax#","Mobile#","Pager#","Address","E-mail","Note"';
/*
I have chosen to output all records to the Sharp Pocket Organizer with a Category of "Others"
for the simple reason that, it is the default category, and all records will show automatically.
Only two other Categories are available (to my knowledge), namely Business and Personal,
*/
$Category "Others";
echo 
$Header_Rec;
  
$fileinname "actexport.txt";
  
$filein fopen($fileinname"r") or die("could not open $fileinname");
  
$fileoutname "sharpimport.txt";
  
$fileout fopen($fileoutname"w") or die("could not open $fileoutname");
// Very important! Write out the header as the first record, otherwise the Sharp 
// Organizer will spin its wheels for 10 minutes and then tell you that no 
// records were found!
fputs($fileout"$Header_Rec\n");
$record_count 0;

  while (!
feof($filein)) {
   
$line fgets($filein1024) ;
// Because I choose to explode the line using '  ","  ' as delimeter,
// the first field, Company, and the last field, Suffix, will have 
// a double quote appended, but then I need to re-quote the fields
// for output anyway.  Remember, if I were to just use comma " , "
// that there are street and company fields which contain commas.
   
$a explode('","'$line);
   
$c 0;
   
  
$Last_Name "";
  
$First_Name "";
  
$Company "";
  
$Home_Number "";
  
$Office_Number "";
  
$Fax_Number "";
  
$Mobile_Number "";
  
$Pager_Number "";
  
$Address "";
  
$E_Mail "";
  
$Note "";

   foreach(
$a as $field) {
    
$c $c 1;
    echo 
"$c: $field<br>";
   }
  
$Last_Name $a[11];
  
$First_Name $a[10];
// Remember! The very first element of a PHP array is not ONE but ZERO!
// So, Company is the ZEROETH element of $a array.
  
$Company $a[0];
// I dont happen to use this field at work $Home_Number = $a[12];
  
$Office_Number $a[6];
  
$Fax_Number $a[7];
// $Mobile_Number = $a[12];
//$Pager_Number = $a[12];

// The next line, which concatenates Street, City, State and Zip
// into one field, Address, is the main motive for me to write a PHP 
// script to reformat
// Act! Contact Management has an export function, but it can only
// export Street, City, State and Zip as separate fields. There is
// no way to concatenate them without writing a program. And the 
// Sharp Organizer only provides one long field for the entire address
// of Street, City, State and Zip
  
$Address $a[2] . "/" $a[3] . " " $a[4] . " " $a[5];
  
$E_Mail $a[15];
//  $Note = "";
 
/*
Header
"Category","Last Name","First Name","Company","Home#","Office#","Fax#","Mobile#","Pager#","Address","E-mail","Note"
*/
echo "Category = $Category<br>";
echo 
"Last Name : $Last_Name <br>  ";
echo 
"First Name : $First_Name <br>";
echo 
"Company : $Company  <br>";
echo 
"Home : $Home_Number <br>";
echo 
"Office: $Office_Number <br>";
echo 
"Fax: $Fax_Number  <br>";
echo 
"Mobile : $Mobile_Number  <br>";
echo 
"Pager: $Pager_Number  <br>";
echo 
"Address: $Address  <br>";
echo 
"E-Mail: $E_Mail  <br>";
echo 
"Note: $Note <br>";

// Now we format the record (string) for output.
$Output '"' $Category '","' $Last_Name '","' $First_Name '",' .
$Company '","' $Home_Number '","' $Office_Number '","' $Fax_Number '","'
$Mobile_Number '","' $Pager_Number '","' $Address '","' $E_Mail '","' .
$Note '"' ;

echo 
$Header_Rec;
echo 
"Output = $Output <br>";
fputs($fileout"$Output\n");
$Record_Count $Record_Count 1;

   echo 
"$line <br><hr>";

  }
fclose($fileout);
echo 
"Record Count = $Record_Count<br>";
/*
The Sharp Pocket Organizer, Model OZ-590 is less that $60.
Today, I used this script to load 1,300 addresses into
the Sharp, and its memory management function indicated that
more that 90% of its memory was free and available.  This
means I should be able to load 13,000 addresses.  The Sharp
runs on one AAA battery. It is very slim and fits easily in
a shirt pocket.
*/

  
echo "<hr />\n".
       
"HAPedit 3.0.11.102 (June 2004 9:46:24 AM)";
?>
</body>
</html> 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP, Act! Contact Mgt. & Pocket Organizers


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway