{"id":420,"date":"2006-04-27T20:36:52","date_gmt":"2006-04-27T20:36:52","guid":{"rendered":"http:\/\/beta.robertprice.co.uk\/robblog\/2006\/04\/using_series_60_python_to_talk_to_a_webserver-shtml\/"},"modified":"2006-04-27T20:36:52","modified_gmt":"2006-04-27T20:36:52","slug":"using_series_60_python_to_talk_to_a_webserver-shtml","status":"publish","type":"post","link":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/","title":{"rendered":"Using Series 60 Python To Talk To A Webserver"},"content":{"rendered":"<p>\nI&#8217;ve been continuing my journey into <a href=\"http:\/\/www.python.org\/\">Python<\/a> by modifying my earlier location script to now post details to my website when run.\n<\/p>\n<p>\nI&#8217;m using the standard <code>urllib<\/code> now and moving to slightly more advanced Python language features such as dictionaries (basically the equivalent of a Perl hash).\n<\/p>\n<p>\nThe code gets the location, calls a CGI script on my website and prints the returned message from that script to the console.\n<\/p>\n<p>\nHere&#8217;s the code&#8230;\n<\/p>\n<div class=\"code\"><code># we need access to the location and urllib modules so have to<br \/>\n#import them.<br \/>\nimport location<br \/>\nimport urllib<br \/>\n# get the mmc, mnc, lac and cellid by calling the gsm_location<br \/>\n# method from the location module.<br \/>\n(mmc, mnc, lac, cellid) = location.gsm_location()<br \/>\n# add the location to a python dictionary called params.<br \/>\nparams = urllib.urlencode({'mmc': mmc, 'mnc': mnc, 'lac': lac, 'cellid': cellid})<br \/>\n# open a filehandle to a cgi tracking script that takes<br \/>\n# the contents of dictionary params as parameters.<br \/>\nf = urllib.urlopen(\"http:\/\/www.robertprice.co.uk\/cgi-bin\/test\/cellid.pl?%s\" % params)<br \/>\n# get the results, hopefully a message saying OK.<br \/>\nprint f.read()<br \/>\n<\/code><\/div>\n<p>\nAll the CGI script on my website does is to record the parameters passed to it and return a simple text string saying it ran OK.\n<\/p>\n<p>\nAs you can see it&#8217;s really simple to Series 60 Python to communicate over the phone&#8217;s network connection. I have to say, this language is turning out to be better than I had expected, and far easier than J2ME.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been continuing my journey into Python by modifying my earlier location script to now post details to my website when run. I&#8217;m using the standard urllib now and moving to slightly more advanced Python language features such as dictionaries (basically the equivalent of a Perl hash). The code gets the location, calls a CGI &hellip; <a href=\"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using Series 60 Python To Talk To A Webserver&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[38,45,53,60,75],"class_list":["post-420","post","type-post","status-publish","format-standard","hentry","category-dev","tag-mobile","tag-nokia","tag-python","tag-s60","tag-web-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using Series 60 Python To Talk To A Webserver - Robert Price<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Series 60 Python To Talk To A Webserver - Robert Price\" \/>\n<meta property=\"og:description\" content=\"I&#8217;ve been continuing my journey into Python by modifying my earlier location script to now post details to my website when run. I&#8217;m using the standard urllib now and moving to slightly more advanced Python language features such as dictionaries (basically the equivalent of a Perl hash). The code gets the location, calls a CGI &hellip; Continue reading &quot;Using Series 60 Python To Talk To A Webserver&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/\" \/>\n<meta property=\"og:site_name\" content=\"Robert Price\" \/>\n<meta property=\"article:published_time\" content=\"2006-04-27T20:36:52+00:00\" \/>\n<meta name=\"author\" content=\"rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_series_60_python_to_talk_to_a_webserver-shtml\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_series_60_python_to_talk_to_a_webserver-shtml\\\/\"},\"author\":{\"name\":\"rob\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"headline\":\"Using Series 60 Python To Talk To A Webserver\",\"datePublished\":\"2006-04-27T20:36:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_series_60_python_to_talk_to_a_webserver-shtml\\\/\"},\"wordCount\":150,\"keywords\":[\"Mobile\",\"Nokia\",\"Python\",\"S60\",\"Web Development\"],\"articleSection\":[\"Dev\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_series_60_python_to_talk_to_a_webserver-shtml\\\/\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_series_60_python_to_talk_to_a_webserver-shtml\\\/\",\"name\":\"Using Series 60 Python To Talk To A Webserver - Robert Price\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\"},\"datePublished\":\"2006-04-27T20:36:52+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_series_60_python_to_talk_to_a_webserver-shtml\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_series_60_python_to_talk_to_a_webserver-shtml\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/using_series_60_python_to_talk_to_a_webserver-shtml\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Series 60 Python To Talk To A Webserver\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\",\"name\":\"Robert Price\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\",\"name\":\"rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"caption\":\"rob\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Series 60 Python To Talk To A Webserver - Robert Price","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/","og_locale":"en_GB","og_type":"article","og_title":"Using Series 60 Python To Talk To A Webserver - Robert Price","og_description":"I&#8217;ve been continuing my journey into Python by modifying my earlier location script to now post details to my website when run. I&#8217;m using the standard urllib now and moving to slightly more advanced Python language features such as dictionaries (basically the equivalent of a Perl hash). The code gets the location, calls a CGI &hellip; Continue reading \"Using Series 60 Python To Talk To A Webserver\"","og_url":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/","og_site_name":"Robert Price","article_published_time":"2006-04-27T20:36:52+00:00","author":"rob","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rob","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/#article","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/"},"author":{"name":"rob","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"headline":"Using Series 60 Python To Talk To A Webserver","datePublished":"2006-04-27T20:36:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/"},"wordCount":150,"keywords":["Mobile","Nokia","Python","S60","Web Development"],"articleSection":["Dev"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/","url":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/","name":"Using Series 60 Python To Talk To A Webserver - Robert Price","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website"},"datePublished":"2006-04-27T20:36:52+00:00","author":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"breadcrumb":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.robertprice.co.uk\/robblog\/using_series_60_python_to_talk_to_a_webserver-shtml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robertprice.co.uk\/robblog\/"},{"@type":"ListItem","position":2,"name":"Using Series 60 Python To Talk To A Webserver"}]},{"@type":"WebSite","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website","url":"https:\/\/www.robertprice.co.uk\/robblog\/","name":"Robert Price","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robertprice.co.uk\/robblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5","name":"rob","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","caption":"rob"}}]}},"_links":{"self":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/comments?post=420"}],"version-history":[{"count":0,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/420\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media?parent=420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/categories?post=420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/tags?post=420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}