RE: [PHP] XML Parsing The Sequel II

2001-02-12 Thread Dave

here is come code (not exactly what you need) that sends an XML
file(variable) to an XML server, and then gets the XML response from
the server and writes it out to a file, returning the filename as the
function return for the php file to resume its processing of the file
in the XML parser (yet another function)

Tried to cut out totally irrelavent or site specific stuff, and added
a few quick comments.  Hopefuly you can follow the logic.

Dave

 in main PHP file 
?
include("./Shipping/shipping.php");
include("./Shipping/shipping2.php");
# process variables and submit = outputs to file, get file name
$xmlFile = ShippingQuote($variables,$to,$pass,$to,$function);
# process file
$xmlOutput = ShippingParse($xmlFile);
?


 in ./shipping/shipping.php 
?
function ShippingQuote($variables,$to,$pass,$to,$function) {
#use database and variables to format and send XML document
$sockPointer = fsockopen("123.456.789.0",5, $errNo, $errStr,
30);
if (!$sockPointer) {
echo "$errStr ($errNo)br\n";
} else {
$xmlTransmit="?xml version=\"1.0\" ?\n
# assembing and formatting the XML document for transmission
\n";
fputs ($sockPointer, $xmlTransmit);
#
# get the response from the server
#
while (!feof($sockPointer)) {
$socketResponse=fgets($sockPointer,4096);
$xmlResponse="$xmlResponse".$socketResponse;
}
fclose($sockPointer);
}
#
# here is the stuff you were really interested in
#
# get a timestamp to save the temp file as
$xmlFile=time();
# create the temp file
$xmlFile="./shipping/".$xmlFile.".xml";
$xfp=fopen($xmlFile,"w");
# write the temp file from the response variable
fwrite($xfp,$xmlResponse);
fclose($xfp);
# return the temp filename for the parser to process
return $xmlFile;
}



 in ./shipping/shipping2.php 
?
function ShippingParse($xmlFile) {
# Do your parsing
# clean up the temp file
system("rm $xmlFile");
# dump reformatted XML  HTML file out of the function
return $returnShipTable;
}
?
-Original Message-
From: Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 11, 2001 9:12 AM
To: 'Dave'
Cc: PHP Mailing Listl (E-mail)
Subject: RE: [PHP] XML Parsing The Sequel II


But how can I automate the saving locally of the file !!!

 -Original Message-
From:   Dave [mailto:[EMAIL PROTECTED]]
Sent:   zondag 11 februari 2001 14:44
To: PHP Mailing Listl (E-mail)
Subject:RE: [PHP] XML Parsing The Sequel II

here is some logic, I'm sure you can flesh out the code.

fopen -r the URL
read the results into a variable, fopen -w to write a local temp file
(if the parser you build actially requires a "file")
save it locally and pass the filename variable to your XML parser
function

if your parser can work from a variable, then just pass the read
variable to your parser.

Dave
clipped


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] XML Parsing The Sequel II

2001-02-12 Thread Steve Haemelinck



 -Original Message-
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]] 
Sent:   zondag 11 februari 2001 11:13
To: PHP Mailing Listl (E-mail)
Subject:[PHP] XML Parsing The Sequel II

Ok, yesterday I had problems parsing an XML from Nasdaq.
Thx to Matt these problems have been solved and I am know able to parse any
XML without problems (I hope).

But I have one question:
In order to parse an XML you have to tell your parser where to find the
document:

$xml_file = ''test.xml';

This works perfectly, but If you want to get the XML files from Nasdaq you
have to say

$xml_file =
http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=NETA;

This however doe not work !!!

Why?  How can I overcome this problem?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] XML Parsing The Sequel II

2001-02-12 Thread Steve Haemelinck

I think I found the problem.

Because I am behind a proxy I can not connect to http://quotes.nasdaq.com.
And get the data !!!


 -Original Message-
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent:   zondag 11 februari 2001 11:13
To: PHP Mailing Listl (E-mail)
Subject:[PHP] XML Parsing The Sequel II

Ok, yesterday I had problems parsing an XML from Nasdaq.
Thx to Matt these problems have been solved and I am know able to parse any
XML without problems (I hope).

But I have one question:
In order to parse an XML you have to tell your parser where to find the
document:

$xml_file = ''test.xml';

This works perfectly, but If you want to get the XML files from Nasdaq you
have to say

$xml_file =
http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=NETA;

This however doe not work !!!

Why?  How can I overcome this problem?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




FW: [PHP] XML Parsing The Sequel II

2001-02-12 Thread Steve Haemelinck



-Original Message-
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent:   maandag 12 februari 2001 21:52
To: 'Steve Haemelinck'
Subject:RE: [PHP] XML Parsing The Sequel II

Ok, I solved the problems with my proxy, I can get the xml but I can not get
it completely.
Why?  Because I am not able to open the tags and that is why it stops at the
first one.
Does anyone has an idea how I can open the tags ?
This is my code so far :)
function GetXMLData($xmlFile_Location){
# Proxy Settings
$proxy_ip="proxy.server.be";
$proxy_port€80;

/* Get the required data from Nasdaq */
$sockPointer = fsockopen($proxy_ip,$proxy_port, $errNo, $errStr,30);
//Connect to Proxy
if( !$sockPointer ){
echo "$errStr Proxy not Available \n \n";
exit();
}
   else{
fputs($sockPointer,"GET $xmlFile_Location / HTTP/1.0\n\n");
while (!feof($sockPointer)){
$Data .= fgets($sockPointer, 1000);
}
}

/* Store the locally for Parsing */
SaveDataLocally($Data, ".xml");
}

-Original Message-
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent:   maandag 12 februari 2001 20:42
To: 'Steve Haemelinck'
Cc: PHP Mailing Listl (E-mail)
Subject:    RE: [PHP] XML Parsing The Sequel II

I think I found the problem.
Because I am behind a proxy I can not connect to http://quotes.nasdaq.com.
And get the data !!!

-Original Message-
From:   Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent:   zondag 11 februari 2001 11:13
To: PHP Mailing Listl (E-mail)
Subject:[PHP] XML Parsing The Sequel II

Ok, yesterday I had problems parsing an XML from Nasdaq.  Thx to Matt these
problems have been solved and I am know able to parse any XML without
problems (I hope).
But I have one question:
In order to parse an XML you have to tell your parser where to find the
document:
$xml_file = "test.xml';
This works perfectly, but If you want to get the XML files from Nasdaq you
have to say
$xml_file =
http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=NETA;
This however doe not work !!!
Why?  How can I overcome this problem?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] XML Parsing The Sequel II

2001-02-11 Thread Steve Haemelinck

Ok, yesterday I had problems parsing an XML from Nasdaq.
Thx to Matt these problems have been solved and I am know able to parse any
XML without problems (I hope).

But I have one question:
In order to parse an XML you have to tell your parser where to find the
document:

$xml_file = ''test.xml';

This works perfectly, but If you want to get the XML files from Nasdaq you
have to say

$xml_file =
http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=NETA;

This however doe not work !!!

Why?  How can I overcome this problem?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] XML Parsing The Sequel II

2001-02-11 Thread Dave

here is some logic, I'm sure you can flesh out the code.

fopen -r the URL
read the results into a variable, fopen -w to write a local temp file
(if the parser you build actially requires a "file")
save it locally and pass the filename variable to your XML parser
function

if your parser can work from a variable, then just pass the read
variable to your parser.

Dave

-Original Message-
From: Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 11, 2001 5:13 AM
To: PHP Mailing Listl (E-mail)
Subject: [PHP] XML Parsing The Sequel II


Ok, yesterday I had problems parsing an XML from Nasdaq.
Thx to Matt these problems have been solved and I am know able to
parse any
XML without problems (I hope).

But I have one question:
In order to parse an XML you have to tell your parser where to find
the
document:

$xml_file = ''test.xml';

This works perfectly, but If you want to get the XML files from Nasdaq
you
have to say

$xml_file =
http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=NETA;

This however doe not work !!!

Why?  How can I overcome this problem?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] XML Parsing The Sequel II

2001-02-11 Thread Steve Haemelinck

But how can I automate the saving locally of the file !!!

 -Original Message-
From:   Dave [mailto:[EMAIL PROTECTED]] 
Sent:   zondag 11 februari 2001 14:44
To: PHP Mailing Listl (E-mail)
Subject:RE: [PHP] XML Parsing The Sequel II

here is some logic, I'm sure you can flesh out the code.

fopen -r the URL
read the results into a variable, fopen -w to write a local temp file
(if the parser you build actially requires a "file")
save it locally and pass the filename variable to your XML parser
function

if your parser can work from a variable, then just pass the read
variable to your parser.

Dave

-Original Message-
From: Steve Haemelinck [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 11, 2001 5:13 AM
To: PHP Mailing Listl (E-mail)
Subject: [PHP] XML Parsing The Sequel II


Ok, yesterday I had problems parsing an XML from Nasdaq.
Thx to Matt these problems have been solved and I am know able to
parse any
XML without problems (I hope).

But I have one question:
In order to parse an XML you have to tell your parser where to find
the
document:

$xml_file = ''test.xml';

This works perfectly, but If you want to get the XML files from Nasdaq
you
have to say

$xml_file =
http://quotes.nasdaq.com/quote.dll?page=xmlmode=stocksymbol=NETA;

This however doe not work !!!

Why?  How can I overcome this problem?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]