So, this week, I was able to teach myself enough html and PHP to host a webpage that, when a button is clicked, prints student canvas data.
I first tried to do this with HTML and JavaScript. However, my last entry explains why that wouldn't work. I knew since I could easily pull data from Canvas using Python, the issue was my use of a client side language vs. a server side one.
Same Origin Policy is incredibly important because, without it, a malicious site could easily pull a user's data from any source they please as long as the user is logged in. However, this isn't possible using a server-side language, such as Python and PHP, because the browser isn't being used.
In order to use PHP, I had to learn how to host a web server. I installed and configured a simple instance of Apache on my mac and visited my site via just typing localhost in the browser address bar. I then hosted a page I called "index.html" and had a button that called "script.php" that loaded the data.
I have 2 steps I plan on taking this week. I first need to parse through the JSON data that Canvas returns in order to receive data that would be useful to our project. Additionally, I need to have a permanent server that will host my site, as well as a public domain name, so my site could be reached anywhere and anytime. Rather than hosting it at home and paying for a domain name, I am going to ask the sysadmins in my CS department if I could get a virtual machine running on their servers, as well as a public domain name (such as cs.nmt.edu/creuproject/index.html).
No comments:
Post a Comment