Quantcast

Maximum PC

It is currently Sun Nov 23, 2014 3:18 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: PHP script to allow Sprint mobile phones to download files
PostPosted: Wed Dec 29, 2004 5:24 pm 
Team Member Top 100
Team Member Top 100

Joined: Fri Sep 17, 2004 5:35 pm
Posts: 1176
I've always had trouble putting files (backgrounds, ringers, etc.) on my cell phone. A year or so ago, I found a site, www.3guploads.com, which allowed you to upload files there and download them to your phone using your phone's web browser.

Their service kind-of sucked. My account was deleted like 5 times in a row, and now they cost money.

This made me sad, because I had no way of getting files to my phone.

So, I wrote a script that is actually useful! I have Apache and PHP installed on my computer, and I have set up a dynamic DNS hosting configuration (visit www.no-ip.org). I made a script that will let you download the files from your own webserver :) It took a bit of research on the Sprint way of downloading files (google "GCD files Sprint"), but I got it.

I thought I'd share the script with you guys:
Code:
<?php
//usage:
//http://yourwebsite/scriptname.php?f=filename.fileextension

$serveraddress = "http://kyboren.redirectme.net/";
$serverfolder = "Files/Mobile/";

$filename = $_GET["f"];
$fileext = strrchr($filename, ".");
$filehandle = fopen($serverfolder . $filename . ".gcd", "w");
$n = "\n";

if(strlen($filename) < 1)
{
   echo "File specified not found.";
}

else if(!$filehandle)
{
   echo "Error writing file.";
}
//
else
{

   if($fileext == ".midi" || $fileext == ".mid")
   {
      fwrite($filehandle, "Content-Type: audio/midi$n");
   }
   if($fileext == ".jpg" || $fileext == ".jpeg")
   {
      fwrite($filehandle, "Content-Type: image/jpeg$n");
   }

   $filepart = substr($filename, 0, (strlen($filename) - strlen($fileext)));
   fwrite($filehandle, "Content-Name: $filepart$n");

   fwrite($filehandle, "Content-Version: 1.0$n");

   fwrite($filehandle, "Content-Vendor: Kybo Ren$n");
   
   $url = $serveraddress . $serverfolder . $filename;
   fwrite($filehandle, "Content-URL: $url$n");

   $size = filesize("./" . $serverfolder . $filename);
   fwrite($filehandle, "Content-Size: $size$n$n");

   fclose($filehandle);

   $url = $serveraddress .  $serverfolder . $filename . ".gcd";//reuse url
   echo "<a href = \"$url\">Download now!</a>";
}//everything was fine, generate the file and give the link
?>


It works fine for me; I don't know how well it'll work for you.
You should change the address and folder variables to meet your needs.


Top
  Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 8:25 am 
King of All Voodoo2 Cards
King of All Voodoo2 Cards
User avatar

Joined: Tue Jun 22, 2004 10:41 am
Posts: 9316
::bump::

Anyone with Sprint who hasn't seen this yet?


Top
  Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 6:10 pm 
Little Foot
Little Foot
User avatar

Joined: Tue Jun 21, 2005 9:39 am
Posts: 187
Location: Austin, Texas
I have sprint, but I don't know how to make it work....=\


Top
  Profile  
 
 Post subject:
PostPosted: Fri Jul 29, 2005 4:00 pm 
Team Member Top 100
Team Member Top 100

Joined: Fri Sep 17, 2004 5:35 pm
Posts: 1176
You need a webserver and PHP.

You have to modify the scripts to reflect your information

Then, put a file you want to be able to download in the directory you specify and on your phone go to:
http://<YOUR URL>/<SCRIPT NAME>?f=<NAME OF FILE>

so like
http://kyboren.redirectme.net/download.php?f=test.jpg


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.