<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stuporglue.org &#187; vcf</title>
	<atom:link href="http://stuporglue.org/tag/vcf/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuporglue.org</link>
	<description>Programming, Rambling and More!</description>
	<lastBuildDate>Tue, 24 Jan 2012 04:18:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Upload your Google Contacts VCF and get a T-Mobile compatible VCF</title>
		<link>http://stuporglue.org/upload-your-google-contacts-vcf-and-get-a-t-mobile-compatible-vcf/</link>
		<comments>http://stuporglue.org/upload-your-google-contacts-vcf-and-get-a-t-mobile-compatible-vcf/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 16:28:22 +0000</pubDate>
		<dc:creator>stuporglue</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[convert vcf]]></category>
		<category><![CDATA[google voice]]></category>
		<category><![CDATA[t-mobile]]></category>
		<category><![CDATA[vcf]]></category>

		<guid isPermaLink="false">http://stuporglue.org/?p=66</guid>
		<description><![CDATA[Upload your Google Contacts VCF and get a T-Mobile compatible VCF Your Google Voice Number (just numbers): Your Google Voice PIN (if required to place call from your cell phone): Route calls through Google Voice: About Want to make placing &#8230; <a href="http://stuporglue.org/upload-your-google-contacts-vcf-and-get-a-t-mobile-compatible-vcf/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: left;">Upload your Google Contacts VCF and get a T-Mobile compatible VCF</h1>
<form style="text-align: left;" action="http://stuporglue.org/gv/form.php" enctype="multipart/form-data" method="post">
<input name="gvcf" type="file" />Your Google Voice Number (just numbers):</p>
<input name="gvn" type="text" />Your Google Voice PIN (if required to place call from your cell phone):</p>
<input name="gvpin" type="password" />Route calls through Google Voice:</p>
<input name="usegv" type="checkbox" />
<input type="submit" value="Make new VCF!" /> </form>
<h2 style="text-align: left;">About</h2>
<p style="text-align: left;">Want to make placing calls through Google Voice easier? Are you on T-Mobile? Me  too. This page gets your Google contacts into your T-Mobile phone, and optionally lets you make all phone numbers route through Google Voice.</p>
<p style="text-align: left;">Google&#8217;s VCF file is incompatible with the VCF files you can upload to  my.t-mobile.com. This page does <a href="http://hopedespite.blogspot.com/2008/12/how-to-export-gmail-contact-phone.html">two quick search-and-replaces</a> to make it work.</p>
<p style="text-align: left;">If you check the box and give your Google Voice number, it will convert each number from: <em>5551231234</em> to <em>17775435432p2p5551231234#</em> where 17775435432 is your  Google Voice number. The p is a pause, which will make it call Google Voice, wait a moment,  press 2 to place a call, dial the number and press #.</p>
<h2 style="text-align: left;">Warning</h2>
<p style="text-align: left;">Use at your own risk. I cannot be held responsible for data loss, misdialed  numbers or other errors that may occur as a result of your use of this site, or your use of the resultant VCF file.</p>
<h2 style="text-align: left;">Code</h2>
<p style="text-align: left;">Here&#8217;s the code I&#8217;m using</p>
<pre style="text-align: left;">&lt;?php

global $errmsg;

function goodFile(){
    global $errmsg;

    if($_FILES['gvcf']['error'] != 0){ $errmsg = "An upload error occurred!"; return false;}
    if($_FILES['gvcf']['type'] != 'text/directory'){ $errmsg = "The file is not a valid VCF file!"; return false;}
    if($_FILES['gvcf']['size'] &gt; 450000){ $errmsg = "Too big!"; return false;}

    return true;
}

function cleanPhoneNumbers($matches){
    $cleanedNumber = preg_replace('/[^0-9]/','',$matches[2]);
    return $matches[1] . $cleanedNumber ."\n";
}

if($_FILES['gvcf'] &amp;&amp; goodFile())
{
    $gv = file($_FILES['gvcf']['tmp_name'],FILE_IGNORE_NEW_LINES);

    // strip non numerics
    $gv = preg_replace_callback('/^(TEL;TYPE=.*:)(.*)$/','cleanPhoneNumbers',$gv);

    if($_POST['usegv'] == 'on' &amp;&amp; $_POST['gvn'] != ""){
	$gvnumpluspin = $_POST['gvn'] . ($_POST['gvpin'] == '' ? '' : 'p' . $_POST['gvpin']);
	$gv = preg_replace('/^TEL;TYPE=(.*):+?([0-9]*)\s*$/','TEL;TYPE=\1:'.$gvnumpluspin.'p2p\2#',$gv);
	$filename = "tmo_gv_" . $_POST['gvn'] . ".vcf";
    } else {
	$filename = "tmo_gv_" . basename($_FILES['gvcf']['name']);
    }

    $find    = array('TYPE=CELL','EMAIL;TYPE=INTERNET','(',')','-');
    $replace = array('TYPE=cell,pref,voice,home','EMAIL;TYPE=INTERNET;TYPE=HOME','','','');
    $gv = str_replace($find,$replace,$gv);

    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; filename=$filename");
    header("Content-Transfer-Encoding: binary");
    print implode("\n",$gv);
}
else
{
?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
    &lt;head&gt;
	&lt;link rel='stylesheet' type='text/css' href='http://stuporglue.org/tako/page/style.css' media='screen'/&gt;
	&lt;title&gt;Google Voice --&amp;gt; T-Mobile&lt;/title&gt;
	&lt;?php include('/home/stuporgl/www/menu.php');?&gt;
&lt;h1&gt;Upload your Google Contacts VCF and get a T-Mobile compatible VCF&lt;/h1&gt;
&lt;? if(isset($errmsg)){ print "&lt;h2 style='color:red;'&gt;$errmsg&lt;/h2&gt;"; } ?&gt;
&lt;p&gt;
&lt;form action='http://stuporglue.org/gv/index.php' method='post' enctype='multipart/form-data'&gt;
Your Google Contacts VCF file: &lt;input type="file" name="gvcf"/&gt;&lt;br/&gt;
Your Google Voice Number (Optional): &lt;input type='text' name="gvn"/&gt; (15553331234) -- no spaces, dashes, parens, etc.&lt;br/&gt;
Your Google Voice PIN (if required to place call from your cell phone): &lt;input type='password' name='gvpin'/&gt;&lt;br/&gt;
Route calls through Google Voice: &lt;input type='checkbox' name='usegv'/&gt;&lt;br/&gt;
&lt;input type='submit' value='Make new VCF!'/&gt;
&lt;/form&gt;
&lt;/p&gt;
&lt;h2&gt;About&lt;/h2&gt;
&lt;p&gt;
Want to make placing calls through Google Voice easier? Are you on T-Mobile? Me
too. This page gets your Google contacts into your T-Mobile phone, and optionally
lets you make all phone numbers route through Google Voice.
&lt;/p&gt;
&lt;p&gt;
Google's VCF file is incompatible with the VCF files you can upload to
my.t-mobile.com. This page does &lt;a href='http://hopedespite.blogspot.com/2008/12/how-to-export-gmail-contact-phone.html'&gt;two quick search-and-replaces&lt;/a&gt; to make it work.
&lt;/p&gt;
&lt;p&gt;
If you check the box and give your Google Voice number, it will convert each number from:
&lt;i&gt;5551231234&lt;/i&gt; to &lt;i&gt;17775435432p2p5551231234#&lt;/i&gt; where 17775435432 is your
Google Voice number. The p is a pause, which will make it call Google Voice, wait a moment,
press 2 to place a call, dial the number and press #.
&lt;/p&gt;
&lt;h2&gt;Warning&lt;/h2&gt;
&lt;p&gt;
Use at your own risk. I cannot be held responsible for data loss, misdialed
numbers or other errors that may occur as a result of your use of this site,
or your use of the resultant VCF file.
&lt;/p&gt;
&lt;p&gt;I do not keep, collect or record any of the information
submitted ot this site, however, this is not a secure (https) site.
&lt;/p&gt;
&lt;p&gt;
This script has very little error checking. Please verify that the contents of
the downloaded file is correct before using it.
&lt;/p&gt;
&lt;?php include('/home/stuporgl/www/footer.php');
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://stuporglue.org/upload-your-google-contacts-vcf-and-get-a-t-mobile-compatible-vcf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

