http call.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kirt

    #1

    http call.

    Hi!

    I have a php program (test.php) on a server. eg:
    http://abc.xyz.com/test.php

    I need my python scripts to make a http call to these program pass some
    data and get back a secret key from the php program..

    Could anyone help me this, what will i need to make a http call to the
    php application?

  • Bruno Desthuilliers

    #2
    Re: http call.

    Kirt wrote:
    Hi!
    >
    I have a php program (test.php) on a server. eg:
    http://abc.xyz.com/test.php
    >
    I need my python scripts to make a http call to these program pass some
    data and get back a secret key from the php program..
    >
    Could anyone help me this, what will i need to make a http call to the
    php application?
    >
    The fact that it's a PHP (or Java or Python or .NET or whatever)
    application is totally orthogonal as long as you're using HTTP. And you
    may want to have a look at the urllib and urllib2 modules in the
    standard lib.

    --
    bruno desthuilliers
    python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
    p in 'onurb@xiludom. gro'.split('@')])"

    Comment

    • Steve Holden

      #3
      Re: http call.

      Kirt wrote:
      Hi!
      >
      I have a php program (test.php) on a server. eg:
      http://abc.xyz.com/test.php
      >
      I need my python scripts to make a http call to these program pass some
      data and get back a secret key from the php program..
      >
      Could anyone help me this, what will i need to make a http call to the
      php application?
      >
      import urllib
      nf = urllib.urlopen( 'http://abc.xyz.com/test.php')
      data = nf.read()

      Should get you started. Look for the "mechanize" and "ClientForm " (?)
      modules to help with the site interactions. It doesn't matter what
      language the server uses: you will be talking HTTP to it!

      regards
      Steve
      --
      Steve Holden +44 150 684 7255 +1 800 494 3119
      Holden Web LLC/Ltd http://www.holdenweb.com
      Skype: holdenweb http://holdenweb.blogspot.com
      Recent Ramblings http://del.icio.us/steve.holden

      Comment

      • haiyun

        #4
        Re: http call.

        Steve Holden 写道:
        Kirt wrote:
        >Hi!
        >>
        >I have a php program (test.php) on a server. eg:
        >http://abc.xyz.com/test.php
        >>
        >I need my python scripts to make a http call to these program pass some
        >data and get back a secret key from the php program..
        >>
        >Could anyone help me this, what will i need to make a http call to the
        >php application?
        >>
        >
        import urllib
        nf = urllib.urlopen( 'http://abc.xyz.com/test.php')
        data = nf.read()
        >
        Should get you started. Look for the "mechanize" and "ClientForm " (?)
        modules to help with the site interactions. It doesn't matter what
        language the server uses: you will be talking HTTP to it!
        >
        regards
        Steve
        Use urllib2 library , you can take more control.

        Comment

        Working...