Hi,
I have following code:
<?php
require_once( "http.inc" );
$user = "jeetn";
$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)
{
$xml = $http->get_response_body();
}
else
{
return -1;
}
}
downloadPlayersXML($teamId);
function contents($parser, $data)
{
echo $data;
}
function startTag($parser, $data)
{
echo "<b>";
}
function endTag($parser, $data)
{
echo "</b><br />";
}
$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);
?>
And I get following errors when I run the page:
**Warning**: fread(): supplied argument is not a valid stream resource in **/home/jump/domains/jumpgenval.be/public_html/php/test.php** on line **74**
**Warning**: feof(): supplied argument is not a valid stream resource in **/home/jump/domains/jumpgenval.be/public_html/php/test.php** on line **76**
**Warning**: fclose(): supplied argument is not a valid stream resource in **/home/jump/domains/jumpgenval.be/public_html/php/test.php** on line **82**
Does anyone know what I have to do?