>Is anything hindering you from using XML expat? You can use that to do it.
>I already post a mail on this, search in the archive for xml related
>posts.

*******************************************************

This is data from a data service.
This is the ENTIRE source code of the URL they let me receive:

<symbol>RHAT</symbol>
<price>6.82</price>
<date>3/4/2002</date>
<time>3:59pm</time>
<change>0.32</change>
<change_percent></change_percent>
<open>6.59</open>
<high>6.99</high>
<low>6.53</low>
<volume>932400</volume>

I'm just now trying to learn PHP. I don't know ANYTHING about XML. I don't
even have any XML reference books yet. I did create a PHP script that is
usable (see below), but there has to be a more efficient way to do it with
PHP. I'll hunt up your post on XML in the archives after I get a XML book.

Thanks

Craig ><>
[EMAIL PROTECTED]


<?

$symbol = "RHAT";

  $url =
"http://www.PAIDDATAPROVIDER.com/services/quote.cgi?quote=".$symbol;
  if (!($fp = fopen($url, "r")))
  {
    echo "Could not open URL";
    exit;
  }
  $rawdata = fread($fp, 10000);
  fclose($fp);

$pricepattern = "(<price>(.*)</price>)";
  if (eregi($pricepattern, $rawdata, $price))

$datepattern = "(<date>(.*)</date>)";
  if (eregi($datepattern, $rawdata, $date))

$timepattern = "(<time>(.*)</time>)";
  if (eregi($timepattern, $rawdata, $time))

$changepattern = "(<change>(.*)</change>)";
  if (eregi($changepattern, $rawdata, $change))

$openpattern = "(<open>(.*)</open>)";
  if (eregi($openpattern, $rawdata, $open))

$highpattern = "(<high>(.*)</high>)";
  if (eregi($highpattern, $rawdata, $high))

$lowpattern = "(<low>(.*)</low>)";
  if (eregi($lowpattern, $rawdata, $low))

$volumepattern = "(<volume>(.*)</volume>)";
  if (eregi($volumepattern, $rawdata, $volume))

?>






On Tue, 5 Mar 2002, Craig Westerman wrote:

> I'm retrieving data from a data service.
> This is the ENTIRE source code of the URL they let me receive:
>
>
> <symbol>RHAT</symbol>
> <price>6.82</price>
> <date>3/4/2002</date>
> <time>3:59pm</time>
> <change>0.32</change>
> <change_percent></change_percent>
> <open>6.59</open>
> <high>6.99</high>
> <low>6.53</low>
> <volume>932400</volume>
>
>
> How can I insert the data values into an array ?
>
> Thanks
>
> Craig ><>
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

<[EMAIL PROTECTED]>
-------------------------------------------------------------------
We must use time wisely and forever realize that the time is
always ripe to do right."

                -- Nelson Mandela
-------------------------------------------------------------------


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to