▼ กำลังโหลดข้อมูล... ▼
แสดงความคิดเห็น
คุณสามารถแสดงความคิดเห็นกับกระทู้นี้ได้ด้วยการเข้าสู่ระบบ
กระทู้ที่คุณอาจสนใจ
อ่านกระทู้อื่นที่พูดคุยเกี่ยวกับ
Python
PHP
HTML
การพัฒนา Mobile Application
การพัฒนา Web Application
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่
รบกวนสอบถามการใช้ โปรแกรม Python อ่าน RFID ใน Raspberry ส่งข้อมูลแสดงบน Webpage หรือ ส่ง data ให้ Php เพื่อแสดงบนเว็บ
code ที่ลองใช้
#python ที่ส่งค่า หลังจาอ่าน RFID แล้ว
import urllib2, urllib
mydata=[('๊UID0','struid[0]'),('UID1','struid[1]')] #The first is the var name the second is the value
mydata=urllib.urlencode(mydata)
path='http://localhost/getdata.php' #the url you want to POST to
req=urllib2.Request(path, mydata)
req.add_header("Content-type", "application/x-www-form-urlencoded")
page=urllib2.urlopen(req).read()
print page
//php getdata.php
<?php
echo $_POST['UID0'];
echo $_POST['UID1'];
?>
มันไม่มีค่าที่ส่งมา
ลอง file php http://localhost/getdata.php?one=1 มีค่าส่งมาปรกติ
ขอบคุณมากครับ