Subpage under development, new version coming soon!
Subject: PHP
I can't indent the ifs.... Sorry!
Maybe it doesn't fully work, use it as a guide.
$user = "Senhor_Castor";
$password = "password";
// Creates the http object
$http = &new http(HTTP_V11, false);
$http->host = "online.sokker.org";
// saves it on the Session
$_SESSION["http"] = $http;
// array with user and password
$form = array('ilogin' => $user,'ipassword' => $password);
//Posts the request
$code = $http->post("/start.php?session=xml", $form, 'http://'.$http->host);
//If the request went fine
if ($code == HTTP_STATUS_OK) {
//Gets the response and from the response, gets the team Id
$response = $http->get_response_body();
$data = explode("=",$response);
// gets the team ID
$teamId = $data[1];
}
// This for example, returns players.xml using the teamId
function downloadPlayersXML($teamId) {
$http = $_SESSION["http"];
//Sets parameters
$form = array();
//Posts the request
$code = $http->post('/xml/players-'.$teamId.'.xml', $form, 'http://'.$http->host);
if ($code == HTTP_STATUS_OK) {
return $http->get_response_body();
}
else {
return -1;
}
}
(edited)
(edited)
Maybe it doesn't fully work, use it as a guide.
$user = "Senhor_Castor";
$password = "password";
// Creates the http object
$http = &new http(HTTP_V11, false);
$http->host = "online.sokker.org";
// saves it on the Session
$_SESSION["http"] = $http;
// array with user and password
$form = array('ilogin' => $user,'ipassword' => $password);
//Posts the request
$code = $http->post("/start.php?session=xml", $form, 'http://'.$http->host);
//If the request went fine
if ($code == HTTP_STATUS_OK) {
//Gets the response and from the response, gets the team Id
$response = $http->get_response_body();
$data = explode("=",$response);
// gets the team ID
$teamId = $data[1];
}
// This for example, returns players.xml using the teamId
function downloadPlayersXML($teamId) {
$http = $_SESSION["http"];
//Sets parameters
$form = array();
//Posts the request
$code = $http->post('/xml/players-'.$teamId.'.xml', $form, 'http://'.$http->host);
if ($code == HTTP_STATUS_OK) {
return $http->get_response_body();
}
else {
return -1;
}
}
(edited)
(edited)
Normally it may not be a problem :)
I allready know Java, Javascript, ASP, VB, RPG, html, xhtml, css...
I allready know Java, Javascript, ASP, VB, RPG, html, xhtml, css...
I allready come for help :)
When I open that page, I get an error which leads me to this line:
$http = &new http(HTTP_V11, false);
The error is:
Fatal error: Class 'http' not found in /home/jump/domains/jumpgenval.be/public_html/test.php on line 13
Can't find that much info on that error :s
When I open that page, I get an error which leads me to this line:
$http = &new http(HTTP_V11, false);
The error is:
Fatal error: Class 'http' not found in /home/jump/domains/jumpgenval.be/public_html/test.php on line 13
Can't find that much info on that error :s
It works ;)
edit: let me tell you differently:
I don't get any errors and also no output... echo "test" works, echo $teamId works
But I don't get my xml with players... Have to look a bit more now :)
(edited)
edit: let me tell you differently:
I don't get any errors and also no output... echo "test" works, echo $teamId works
But I don't get my xml with players... Have to look a bit more now :)
(edited)
Solved it :)
Now I got to order the data I get a bit more...
Guess I need a xmlparser to do so?
Now I got to order the data I get a bit more...
Guess I need a xmlparser to do so?
I always thought you had to do it with the curl command, but http is another option?
Http.php is a file where an objet is defined. Maybe inside uses curl or whatever, i don't know, i just use http->post, http-get and those functions provided by that library.
I don't know how it works, and i don't care either.
:)
I don't know how it works, and i don't care either.
:)
This is my current code:
[i]
function contents($parser, $data)
{
echo $data;
}
function startTag($parser, $data)
{
echo "";
}
function endTag($parser, $data)
{
echo "";
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "contents");
$fp = fopen($xml, "r");
$data = fread($fp, 80000);
if(!(xml_parse($xml_parser, $data, feof($fp)))){
die("Error on line " . xml_get_current_line_number($xml_parser));
}
xml_parser_free($xml_parser);
fclose($fp);
?>[/i]
I get an error he doesn't recognize fread, feof and fclose... fopen he does recognize :s
edit: Had to leave a part away cause he did not want to post it :s
(edited)
[i]
function contents($parser, $data)
{
echo $data;
}
function startTag($parser, $data)
{
echo "";
}
function endTag($parser, $data)
{
echo "";
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "contents");
$fp = fopen($xml, "r");
$data = fread($fp, 80000);
if(!(xml_parse($xml_parser, $data, feof($fp)))){
die("Error on line " . xml_get_current_line_number($xml_parser));
}
xml_parser_free($xml_parser);
fclose($fp);
?>[/i]
I get an error he doesn't recognize fread, feof and fclose... fopen he does recognize :s
edit: Had to leave a part away cause he did not want to post it :s
(edited)
The code above sucks :)
Allready have new code which works ;)
Now I've got to work my way through different xml files to get what I want... That is the username and teamname of all 4th and 5th division teams of belgium :)
Allready have new code which works ;)
Now I've got to work my way through different xml files to get what I want... That is the username and teamname of all 4th and 5th division teams of belgium :)
You don't need to do that manually, you can find it with the XML interface.
But I still need to write the code ;)
And to get all those name's I have to make several of loops...
But right now I'm still figuring out how to get all the names of my players...
That's difficult enough for the moment :)
And to get all those name's I have to make several of loops...
But right now I'm still figuring out how to get all the names of my players...
That's difficult enough for the moment :)