You are not logged in.

#1 19 Jun 2008 5:51 am

bigbacon
New Member
Registered: Jun 2008
Posts: 4

stats feed & asp.net

First, thanks again Madhatter. I did come up with another question regarding getting the feeds.
Right now my webhost doesn't allow me to get the feeds in any good way. I was using a webservice and I tried good olde xmlhttp request, none which will allow me to get the databack. I knoew it's a cross domain thing.

Right now my stats page is 100% manual and I'm trying to change that. If you want to get an idea of what I go through check it out here.
http://chadcarey.com/2142/2142.aspx

The only way I found to this is to create iframes with the urls for the feeds and then manually copy/paste them to import them into a database I made. I tried some crazy stuff like using JS to copy/paste for me but it never works. Iframe as so locked out for security you can't do much with them.

I know there are ways to do this (I think JSON is what people suggest) but I have never used this nor do I know anything about it.

WHat did others do to get around this possible block? I'm using VB.net at the moment but I'll most likely retrofit everything to C# if the authcode code is found.

Last edited by bigbacon (19 Jun 2008 5:53 am)

Offline

 

#2 19 Jun 2008 11:09 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: stats feed & asp.net

You may ask winsr if you can use his implementation (he did port it from php to vb.net, and as a dll you can use it as a reference if he's ok w/ that), or you can add a web reference to:

Code:

http://sanity-free.org/bf2142auth/service.php?wsdl

Offline

 

#3 19 Jun 2008 11:40 am

bigbacon
New Member
Registered: Jun 2008
Posts: 4

Re: stats feed & asp.net

wow. that was simple..

I'll PM him because I'd still like to see the conversion if he's willing to share. I tried to convert it because my understanding of PHP is rather poor.

Last edited by bigbacon (19 Jun 2008 12:15 pm)

Offline

 

#4 20 Jun 2008 9:19 am

winsr
Extreme Member
Registered: Mar 2007
Posts: 90

Re: stats feed & asp.net

sup bacon...

here is my port to vb.net 2005 dll http://www.crbf-team.com/software/bf214 … ctions.dll

and here is an example code of how to use it

Code:

Dim myRequest(24) As String, code As String = "", result As String = "", AuthCode As String
Dim EA_Operation As New Functions.ea_stats
Dim AwardsResult as string = ""

code = EA_Operation.dwh(Hex(DateDiff("s", "1/1/1970", DateTime.UtcNow) + 21600)) & EA_Operation.dwh(Hex("100")) & EA_Operation.dwh(Hex(Long.Parse(PID))) & "0000"
code = code & EA_Operation.CalcCRC(code)
result = EA_Operation.DefEncryptBlock(EA_Operation.hex2str(code))
AuthCode = EA_Operation.getBase64Encode(result)

AwardsResult = Web.DownloadString("http://stella.prod.gamespy.com/getawardsinfo.aspx?auth=" & AuthCode & "&gsa=&pid=" & PID)

After this you just need to start calling all the other functions that are on the wiki.

Offline

 

#5 23 Jun 2008 4:39 am

bigbacon
New Member
Registered: Jun 2008
Posts: 4

Re: stats feed & asp.net

I found a way to get the data without using your dll (though it helps for the authcode)

Code:

        Dim r As Net.WebRequest = Net.HttpWebRequest.Create("http://stella.prod.gamespy.com/getplayerinfo.aspx?auth=" & auth & "&mode=" & mode)

        r.Method = "GET"

        Dim w As System.IO.StreamReader = New System.IO.StreamReader(r.GetResponse().GetResponseStream())

        Dim a As String = w.ReadToEnd

        w.Close()

        Return (a)

so I was able to take my old manual javascript version and just use the above to loop through all the modes and get the data. If curious, I updated my stat page here htt:"//chadcarey.com/2142/2142.aspx
Now all I need to do is insert a PID (at some point a nick search will be there)

Thanks for your help guys. You got my brain going on this and the auth-code services REALLY helped out.

Offline

 

#6 23 Jun 2008 8:00 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: stats feed & asp.net

I think the ideal way for a web site to pull stats is to import gamespy's output to your own database, and pull from the database.  you could do a check to see if the player table has a pid or nick matching the one posted.  if it doesn't you can use the player search to find matches, then use that to pull player info (player search returns a player nick and profile id (pid) that you can use to pull stats with). 

If I were making a stats site, that's what I'd do anyway.

Offline

 



© 2003 - 2017 NullFX
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License