cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

please help, cURL to retrieve e-gold exchage rate

From: Teguh Handoko <hndko_th_at_solonet-online.net>
Date: Wed, 25 Sep 2002 23:25:12 +0700

Please help me with some problem as follows.

I run cURL from MSDOS prompt and run:
C:> curl http://www.e-gold.com/unsecure/metaldata.asp?latest=1

it works, it outputs something like:
9/21/02 11:30 AM, 320.00, 4.324, 540.34, 321.98

But when I run from cURL from PHP (code as follows):
<php
$curlargs = "http://www.e-gold.com/unsecure/metaldata.asp?latest=1" ;
$safecurlargs = escapeshellcmd($curlargs);
exec("\curl\curl -s $safecurlargs",$output);
while (list($indeks,$res)=each($output))
 print("Indeks: $indeks, $res <BR>\n");
?>

Array $output does NOT contain any of the expected result of rate, but it outputs
something like:

Indeks: 0,
Indeks: 1,
Indeks: 2,
Indeks: 3,
Indeks: 4,
Indeks: 5,
Indeks: 6,
Indeks: 7,

Indeks: 8,
Not Found
Indeks: 9,

Indeks: 10,
The location you tried
Indeks: 11, to access is not a valid one. (Possibly our new web layout has changed a file name that
Indeks: 12, you might have bookmarked). If you believe this is in error please contact
Indeks: 13, the Gold & Silver Reserve.

What should be the correct code ?
Thanks

Regards
Gogo

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-09-26