Info: Networking: URLlib, HTTP, FTP, SSL, TCP/IP socket

Downloading files from the net using URLlib:

Example (useful for simply downloading files from the net):

import urllib

url = ""
tempfile = "c:\\testimg.gif"
urllib.urlretrieve(url, tempfile)

Example script :


Uploading parameters and files to the net and receiving a response:

HTTP post example (useful for uploading parameters and files to the net):

import httplib
import urllib

content = "hello"

params = urllib.urlencode({'data': content, 'eggs': 0, 'bacon': 0})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn = httplib.HTTPConnection("")
conn.request("POST", "/examplefolder/example.php", params, headers)
response = conn.getresponse()

Example script :

Example php script : example.php

For encoding descriptions and other info regarding HTTP see:



FTP example (useful e.g. for uploading files to a URL on the net):

NOTE: you need to install first the ftplib library to your phone before you can use ftp, because the Nokia Python for S60 package does not incude it by default. NOTE: You need to install the file on your phone as a python library (not a python script).

ftp library file: (comes originally with the desktop python version)


from ftplib import FTP

picselection = 'c:/testimg.gif'

ftp = FTP('') # connect to host
ftp.login('username','password') # login anonymous
ftp.cwd('public_html/examplefolder') # change directory where to store the image
ftp.storbinary('STOR image.gif',F,1024) # store the image

Example script :

For documentation regarding FTP see:


SSL (useful e.g. for secure connections to the net):

Example script : (script currently not available)




TCP/IP socket:

Connect your phone to a TCP/IP socket and communicate over it:

Example script for phone:

Example script for PC:











Previous|Next  | Menu        Copyright (c) 2006 Jurgen Scheible