×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    A question about using httplib. Help please.

    Hi,
    I have tested the following code on my 5320XM(S60V3),but it didn't work(and it had successful run on S60V2),if changed "data = r.read().decode('utf8')" to "data = r.read()",it worked but didn't print the source of the web page.It's important for me,thanks a lot!
    ------------------------------
    import httplib,appuifw
    appuifw.app.body = m = appuifw.Text()
    conn = httplib.HTTPConnection('10.0.0.172', 80)
    conn.request('POST', 'http://wap.google.com/')
    r = conn.getresponse()
    data = r.read().decode('utf-8')
    conn.close()
    m.set(data)
    ------------------------------
    Last edited by bzsy; 2009-06-16 at 01:57.

  2. #2
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Re: A question about using httplib. Help please.

    Eh...Nobody can help me?I just want to know how to get the source of a web page...

  3. #3
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    114

    Re: A question about using httplib. Help please.

    Quote Originally Posted by bzsy View Post
    Eh...Nobody can help me?I just want to know how to get the source of a web page...
    Use urllib instead of httplib.

    import urllib
    source_code = urllib.urlopen(<insert web page address>).read()
    print source_code
    import antigravity

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: A question about using httplib. Help please.

    Quote Originally Posted by bzsy View Post
    Eh...Nobody can help me?I just want to know how to get the source of a web page...
    hello bzsy

    i guess your code is just reading the page and printing it.

    BTW What output you get.

    Enjoy Pythoning
    Gaba88

  5. #5
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: A question about using httplib. Help please.

    Quote Originally Posted by bzsy View Post
    Eh...Nobody can help me?I just want to know how to get the source of a web page...
    Here you are:

    http://jouni.miettunen.googlepages.com/accesspointtest

    Enjoy,

    --jouni

  6. #6
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Re: A question about using httplib. Help please.

    Thank everyone for your answers,I'll test them as soon as I can.

Similar Threads

  1. Replies: 0
    Last Post: 2006-02-20, 11:51
  2. Annoying question when dialing by bluetooth
    By tejohf in forum Bluetooth Technology
    Replies: 0
    Last Post: 2003-09-04, 19:56
  3. Newbie question: What is the call stack?
    By advocatee in forum Symbian
    Replies: 2
    Last Post: 2003-06-22, 05:27
  4. Replies: 0
    Last Post: 2003-04-07, 09:52
  5. question deleted
    By kiokups in forum General Messaging
    Replies: 1
    Last Post: 2002-09-25, 20:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×