Lets experiment with it just to confirm its all

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: strange stuff, that’s ok too… it’ll become clear what that means shortly). If you can’t see anything at all, and have followed these instructions carefully, check with a demonstrator. The server you’ve now set up acts as a simple state store: you can give it the name of a variable (called a ‘key’), and its value, and ask it to remember this for you; and you can later retrieve the value of that variable/key. Let’s experiment with it, just to confirm it’s all working correctly. Using your browser, enter the URL http://soba.cs.man.ac.uk/~myusername/IMServer.php?action=set&ke y=test1&value=hello The browser will respond with a blank page, but should now have remembered that the value of the key ‘test1’ is ‘hello’. Look at http://soba.cs.man.ac.uk/~myusername/IMServer.php again. There should now be a line under the heading that looks something like: a:2:{s:5:"test1";s:4:"hello"; } Don’t worry about the a:2 and s:5 parts; they are likely to vary from case to case, and are just bits of internal implementation and really aren’t important. What matters is that you can see ‘test1’ and ‘hello’ in the list of things the server has remembered. Try setting a few more key/value pairs, and confirming that they are being remembered, then try something like http://soba.cs.man.ac.uk/~myusername/IMServer.php?action=unset& key=test1 to make sure that you can unset them too. Finally, let’s make sure that we can retrieve the values sensibly. Put a key/value pair in to the server’s store, then try something like http://soba.cs.man.ac.uk/~myusername/IMServer.php?action=get&ke y=test1 to retrieve it. Your browser should respond with just the value you’ve put in there previously2 (assuming you’ve not unset it in the meantime!) If everything...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online