如何使用Python将HTTP POST值发送到(PHP)页面? [英] How do I send a HTTP POST value to a (PHP) page using Python?

查看:100
本文介绍了如何使用Python将HTTP POST值发送到(PHP)页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP页面,其中有1个文本框,当我按提交"按钮时.我的SQL将将此产品名称存储到我的数据库中.我的问题是;是否可以使用要求1值的Python脚本发送/发布产品名称,然后使用我的PHP页面将其发送到我的数据库?谢谢!

I have a PHP page that has 1 textbox and when I press on the submit button. My SQL is going to store this product name into my database. My question is; is it possible to send/post the product name using Python script that asks for 1 value and then use my PHP page to send it to my database? Thanks!

推荐答案

签出urllib和urllib2模块.

Check out the urllib and urllib2 modules.

http://docs.python.org/library/urllib2.html

http://docs.python.org/library/urllib.html

仅使用所需数据创建一个Request对象.然后从您的PHP服务中读取响应.

Simply create a Request object with the needed data. Then read the response from your PHP service.

http://docs.python.org/library/urllib2.html #urllib2.Request

这篇关于如何使用Python将HTTP POST值发送到(PHP)页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆