如何将值从php传递到python
<?php $print_this = "hello world";
//pass it to python. then echo it in here. "hello world";
?>
如何将一个变量的值从php传递给python,python将返回它,php将回显它。你知道吗
import sys
import urllib
from BeautifulSoup import BeautifulSoup as BS
url = '''http://www.kumby.com/avatar-the-last-airbender-book-3-chapter-5/'''
#open and read page
page = urllib.urlopen(url)
html = page.read()
#create BeautifulSoup parse-able "soup"
soup = BS(html)
#get the src attribute from the video tag
video = soup.find("iframe").get("src")
print video
变量url应该来自php。在php中
$url=网站
我的python代码应该是
url=$url
或者我不知道怎么做。我刚刚听说php可以调用python。所以我在想有没有可能把php的变量传递给python。你知道吗
现在变量video的值应该在php中得到响应。你知道吗
你可以用管道:
您不需要Python,因为PHP有multiple ways来解析HTML/XML。你知道吗
下面是一个使用DOM extension的示例:
您可以使用$\u GET将变量发送到python脚本,并且python可以将值作为api返回。。。或者你可以在php中使用curl()
相关问题 更多 >
编程相关推荐