Page 2 of 2

Posted: Mon Sep 15, 2003 11:21 am
by JAM
-> is when you call on something using a class...
=> is usually what you use when you assign values in arrays...

Code: Select all

// perhaps not the best description but...
// initialize a new class, call it $var
$var = new class();
// use $var (the class) and call the somefunction within...
$var2 = $var->somefunction('foo');

// array
$array = array('foo'=>'bar', 'moo'=>'cow');
About the class. Boss is watching over my shoulder, so I should work. ;)
If somone else havn't replied when I got home, i'll look at it.

Try if you can figure something out with my earlier post meanwhile.

Posted: Mon Sep 15, 2003 2:27 pm
by Sinnix
JAM wrote:-> is when you call on something using a class...
=> is usually what you use when you assign values in arrays...
Hmmm... thanks. I think I'm going to go out and pick up a new book tonight. My poor PHP book is about three years out of date and doesn't explain that very well. ;)

For interests sake, I managed to find a really easy way to connect to the Java Servlet... it's the same as opening a file!

Code: Select all

<?php
//define variables
	$user = "bob";
	$serverBaseUrl = "http://206.222.76.240:8080/LMS/intermap/servlet/information";
	$role = "trainer";
	$request = "rot";
	$course = 1129;
	
	$xmlString = "<LMSIS_REQUEST request_type='get' content_type='".$request."'>";
	$xmlString .= "<GET><XPATH>";
	$xmlString .= "/TRAINING_RECORD[@course_id='".$course."' and user_id='".$user."']";
	$xmlString .= "</XPATH></GET></LMSIS_REQUEST>";
	$url = $serverBaseUrl . "?user=".$user;
	$url .= "&role=".$role."&request=".urlencode($xmlString);

function GetData($url){
		// Connects to ADGA Java Servlet and requests an XML file.
		$responseFH = fopen($url,"r");
		$responseString = "";
		while( $nextLine = fgets($responseFH,1024) )
		{
			$responseString .= $nextLine;
		}
		fclose($responseFH);
		return $responseString;
	}
Now all I have to do is seriously increase my knowledge in parsing XML documents!! One step at a time!! (I'm gonna be a XML/PHP parsing expert by the end of the week!!! lol)