Hello, I am having trouble understanding the following Xor enryption method written in C:

Code:
void gamespyxor(u_char *data, int len) {
    u_char  gamespy[] = "gamespy",
            *gs;

    for(gs = gamespy; len; len--, gs++, data++) {
        if(!*gs) gs = gamespy;
        *data ^= *gs;
    }
}
I would like to get PHP code or VB code that would convert whatever string of data I want using the method above. The person who wrote that code hasn't been able to explain it very well to me, and takes a long time to answer my questions, so I have come here for help with it. He did say the following though:

It's very very simple, XORing is the base for any encryption algorithm.
Each byte of the string must be XORed with "gamespy"
So I am trying to get PHP or VB to replicate the code above, and XOR any piece of text or string I want by the term 'gamespy'. However I just can't figure out exactly how to do it, or seem to understand what is really going on (in easy terms). I have been playing around with XOR functions all day in VB and php, and no matter what I do I cant get my strings to convert into what they should be. Here are some before/after examples of what SHOULD be happening when I convert a string. These types of strings are the ones I will be working with:

Example 1:
Before: \unok\cd\81dc9bdb52d04dc20036dbd8313ed055\skey\125 7\errmsg\Invalid CD Key

After: ;....,%..1]B.. ^...FB.WU..A@ITW ...HJVR..CEL;... .,HUTZ9......9:. .....S3=G*..
Example 2:
Before: \unok\cd\202cb962ac59075b964b07152d234b70\skey\151 9\errmsg\Invalid CD Key

After: ;....,%..1WCB. .X[W..L^QZP.IOS. ]RBEK.S^Q.GI;... .,HRPT9......9:. .....S3=G*..
No worries though, no important data is being encrypted here, I am only doing this because the particular server I am working with requires text to first be XORd by the term "gamespy" or it will not communicate with a client. It also sends its replies encrypted this way, so I will have to learn how to encode/decode anything string I need to.

Hope that explains my question, thank you very much for the help! Post if you need more information.