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: »[news] XML Data Improvements

2009-03-17 10:35:15
try something like this:

curl_setopt($ch, CURLOPT_URL,"$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_COOKIESESSION,true);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH,true);
curl_setopt($ch, CURLOPT_COOKIEJAR,'/web/sokker.cz/sokker.cz/service/'.$scriptName.'.txt');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "ilogin=$login&ipassword=$password&submit=Submit");
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
$page = curl_exec($ch);
2009-03-17 22:04:03
Thanks !

Here is the code for the login :

[color=orange]$url = "http://online.sokker.org/start.php?session=xml";
$data = array ("ilogin" => "******","ipassword" => "******");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url) or die("Erreur CURLOPT_URL");
curl_setopt($ch, CURLOPT_POST, 1) or die("Erreur CURLOPT_POST");
curl_setopt($ch, CURLOPT_POSTFIELDS,$data) or die("Erreur CURLOPT_POSTFIELDS");
curl_exec($ch) or die ("Erreur curl_exec");
[/color]

And then, I use a function :

[color=orange]function curl_download($remote, $local) {
$cp = curl_init($remote);
$fp = fopen($local, "w");
curl_setopt($cp, CURLOPT_FILE, $fp) or die("Erreur CURLOPT_FILE");
curl_setopt($cp, CURLOPT_HEADER, 0) or die("Erreur CURLOPT_HEADER");
curl_exec($cp) or die("Erreur curl_exec");
curl_close($cp) or die("Erreur curl_close");
fclose($fp) or die("Erreur fclose");
}[/color]

And then :

curl_download("http://online.sokker.org/xml/team-[11947].xml","http://ephixe.free.fr/gesteam/xml/team-[11947].xml");

Is it serious, doctor :) ?

Cdt,

@BlueZero : thanks too, but how do you use it ?
(edited)
(edited)
2009-03-18 08:31:02
This is the login

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_COOKIESESSION,true);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH,true);
curl_setopt($ch, CURLOPT_COOKIEJAR,'/web/sokker.cz/sokker.cz/service/'.$scriptName.'.txt');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "ilogin=$login&ipassword=$password&submit=Submit");
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
$page = curl_exec($ch);

Now you are logged in.
Notice the row with CURLOPT_COOKIEJAR, it will write the cookie in the file (change the setting to you file), then it will use it to repost cookie.

then you just have to
curl_setopt($ch, CURLOPT_URL,"$url");
$page = curl_exec($ch);

and you will get the page you want.
2009-03-18 09:25:30
The second $url is "http://online.sokker.org/xml/team-[11947].xml", for example ?

And then, what do you do with the $page ?

Download ? Parse ?

Thanks for your help !
2009-03-18 10:00:34
yes for example that page. but it should be http://online.sokker.org/xml/team-11947.xml

in $page you have the entire xml. I parse it. I dont know what you want to do with it ;-).
2009-03-18 11:42:09
I thought you must download the file before parsing it...

I'll try this evening with your code, thanks !
2009-03-18 11:58:27
this command downloads the file: $page = curl_exec($ch);
2009-03-18 21:53:45
Well, it works, I can read and parse the file :)

Thank you very much, BlueZero !!

Now, I just have to work :D
2009-03-18 22:10:15
You are welcome ;-)
2009-03-23 15:08:24
¿How can I download files xml of the leagues of one division? I want to make a list of teams that amount and go down of one divisions.

But I want to know if you know some method to make it easy and simple, or a program to do it faster than manually.
2009-03-27 15:40:04
i have problem when i write to me browser
http://online.sokker.org/xml/players-[23213].xml

i see only this :
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<sokkerData>EMPTY</sokkerData>

What should i do ?
2009-03-27 15:59:17
Remove the [] :)

http://online.sokker.org/xml/players-23213.xml
2009-05-06 20:08:51
tell you what would be a good new addition to this - an xml file which shows you the matches of the current cup round.



hmmmm actually http://online.sokker.org/xml/matches-league-1009-2.xml gives me the matches for round 2 (week0??) for scotland. Does anyone know IF there is a league range for cup games?
(edited)
2009-05-06 20:40:37
ok this is the same for all cups. This is a bit of a nuisance to pull cup data down - we are in week 0 yet the cup is in round 2. Nooooooooooo

This IS fixable but i would need to know the actual cup league ID details. Anyone? (lets hope its in a reserved block)
2009-07-02 16:04:00
chaps. I am using the following code to login.

$ch=curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookieFileName");
curl_setopt($ch,CURLOPT_URL,"http://online.sokker.org/start.php?session=xml");
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"ilogin=$userid&ipassword=$pass");
curl_setopt($ch,CURLOPT_DNS_USE_GLOBAL_CACHE,false);
ob_start();
curl_exec($ch);
ob_end_clean();
return $ch;

it works fine BUT i am unable to tell if the login worked or not. Obviously if the login works then the xml is downloaded but for the life of me i cannot make it stop attemtping to grab xml if the login fails.

Any help?
2009-07-02 16:23:05
From xmlinfo.php:

POST variables are ilogin and ipassword.

Possible replies from the script:
# "OK" - athentication succeded
# "FAILED errorno=[error number]" - athentication failed
(1 - bad password, 3 - user has no team, 4 - user is banned, 5 - user is a bakrupt, 6 - user IP is blacklisted)


Maybe it could help you...

By the way, if someone is skilled enough in Visual Basic and could help me to open from Excel the XML files with a script, I would very much appreciate :)