Azərbaycan dili Bahasa Indonesia Bosanski Català Čeština Dansk Deutsch Eesti English Español Français Galego Hrvatski Italiano Latviešu Lietuvių Magyar Malti Mакедонски Nederlands Norsk Polski Português Português BR Românã Slovenčina Srpski Suomi Svenska Tiếng Việt Türkçe Ελληνικά Български Русский Українська Հայերեն ქართული ენა 中文
Subpage under development, new version coming soon!

Subject: xml

  • 1
  • 2
2006-11-27 02:06:27
khufu23 [del] to All
Does anybody know how to load the xml team data into a web page? Not the browser-interpreted version, but the actual xml file?
2006-11-27 05:07:20
in PHP?
2017-08-30 22:18:10
Hi, I want learn how to download info to the xml files but I can't
I try this in php with function curl and it's work, I get the answer OK teamID=29016 (my team in this case)

The problem is that I don't know how generate the xml files, in web proof it's ok but in the application I can't move fordward.
I try with this function but is not work. I would appreciate any help.

$xml = simplexml_load_file('http://sokker.org/xml/team-29016.xml');
2017-08-30 22:38:40
You probably need to get session id from response headers or content after successful authentication request and send every subsequent request (like xml/team-23456.xml) with that session id added to Your request headers

from http://sokker.org/xmlinfo.php page:
After authentication session is created. Session key ("XMLSESSID") is passed as a Cookie, just like with regular browsers.

EDIT: That session key can be get from document loaded after successful authentication (the one containing "OK team=29016"). This document (the DOM/HTML document) has attribute cookie which contains some key=value pairs and one of them should be XMLSESSID=your_xml_session_identifier.
And when You send the next request (like xml/team-29016.xml) add Cookie with content XMLSESSID=your_xml_session_identifier to request headers and it should work.
I have never use PHP so I don't know how to get those Cookies from response but this should be helpful: https://stackoverflow.com/questions/22393935/get-read-javascript-cookie-with-php
(edited)
2017-08-31 00:14:32
will send you tomorrow php code that works just remind me
2017-09-24 03:18:16
Hello everybody, I need some help.

I have a big list with player-ID´s, on a column of an excel-sheet. (German U21 players from different teams*)

On the next 2 columns of the player-ID´s I want:
- (a) their form values (e.g. "9" for very good form) and
- (b) the player value (e.g. 2000000 )

Can anybody help me getting these columns automatically filled?
I will appreciate any help. :)

____________________________
*Germany uses a different NTDB and this is my problem; form, player value, tactical discipline etc. do not exist on this different NTDB
2017-09-24 03:21:37
if i remember, German ntdb is similar to Swiss ntdb, maybe Fanakick could help you?
2017-09-24 13:26:15
i dont use excel but imo that's not possible to import xml data into an excel sheet automatically.
You can construct a link with the playerID like this : http://sokker.org/player/PID/playerID , so you have direct links to check forms for every players.
2017-09-24 14:03:54
In excell you can get values from external web pages it was long time i did similar to get marketing data at work but is possible
https://support.office.com/en-us/article/Get-external-data-from-a-Web-page-708f2249-9569-4ff9-a8a4-7ee5f1b1cfba

import of xml is just manual action
2017-09-25 08:48:59
yep but we need an xml session before to get data.
(edited)
2017-09-25 11:08:31
i dont use excel but imo that's not possible to import xml data into an excel sheet automatically.
I am not sure about excel but in alternative software libre office You can write python script/macro which will do all the shit. So You can open xml session, get xml data, and put it in sheet. At least, IIRC You can. And I think that such macro have to be triggered by user.

In excel You can also write script/macro but probably only in some primitive programming language (VBA or whatever it is called) which may not let You do more sophisticated magic.

Although, the way with http://sokker.org/player/PID/playerID seems to be a lot easier, because it does not need logging in but despite of that fact there is access to required data like form/value/discipline. Moreover, this way You will need to parse HTML page to get that data.
2017-09-25 13:15:08
There are good parsing options in vbscript but is not fun yes.
2017-09-25 16:25:19
Thank you all for your answers.

I will try it with Libre office and python.
(I tried past weekend a lot with excel based on the msoffice support and it was a totally fail)
2017-09-26 00:33:51
In case someone is interested, here is simple script/macro for libre office. It's written in python and works as follows. Gets authentication data from some config file and then it logs into sokker/xml, gets XMLs of players whose ids are in first column (from 1st row to 1st empty row) and put some of their data (value, wage, form) in the same row in three following columns skipping non existing players.
https://www.dropbox.com/s/vqoag6ftg5mja0d/sokkerCalc.py?dl=1
2017-09-26 00:38:27
if you want it in vba excel this code can serve you ;)

Sub download()

Dim idPlayer, variable As Long
Dim i, pos1, pos2 As Integer
Dim sName As Name

With ActiveSheet.QueryTables.Add(Connection:="URL;http://online.sokker.org/start.php?session=xml", Destination:=Range("$F$1"))
.PostText = "ilogin=" & "your user" & "&ipassword=" & "your pass"
.Refresh BackgroundQuery:=False
End With

ActiveWorkbook.Connections("Conexión").Delete
For Each sName In ThisWorkbook.Names
sName.Delete
Next

i = 1
finish = False
Set XML = CreateObject("Microsoft.XMLHTTP")

While finish = False
i = i + 1
idPlayer = Cells(i, 1)
If idPlayer > 0 Then
web = "http://online.sokker.org/xml/player-" & idPlayer & ".xml"
XML.Open "POST", web, False
XML.Send
texto = XML.responseText

'form
pos1 = InStr(texto, "¿skillForm>") + Len("¿skillForm>")
pos2 = InStr(texto, "¿/skillForm>")
variable = Mid(texto, pos1, pos2 - pos1)
Cells(i, 2) = variable

'value
pos1 = InStr(texto, "¿value>") + Len("¿value>")
pos2 = InStr(texto, "¿/value>")
variable = Mid(texto, pos1, pos2 - pos1)
Cells(i, 3) = variable
Else
finish = True
End If
Wend
Set XML = Nothing

End Sub


Column 1: Id player, column 2: form and column 3: value
replace your user and pass... and "¿" for ... the forum does not let me post them
(edited)
(edited)
2017-09-26 23:02:20
Yeah!!! It works!

Last weekend I tried VBA in Excel and it was a total fail.
Then I tried in portable Libre Office Calc (4.4.0.3) the python script sent by Kryminator, but my knowledge was not enough to get it run.
Finally I used the vba excel code from manus and it works!


I had to made a small modification to get it run. I removed this part:

ActiveWorkbook.Connections("Conexión").Delete
For Each sName In ThisWorkbook.Names
sName.Delete
Next

I have no idea what it is about, but finally I have a solution to save a lot of time! (On the german ntdb I could not see form and value...)

Thank you all and my special thanks to Kryminator, the developer of the SkUnk-extension, which is a big gift for the whole sokker community
and also my special thanks to Manus who also spent his time to help me, despite the fact that Kryminator had already offered me a solution.

My respect and my gratitude
  • 1
  • 2