-1

I'm trying to extract the price from a json output using php.

The price is listed as "price": "49.00", I understand I need to use preg_match, but I'm having trouble with the regex (possibly)

Would preg_match also be the best function to use when looking for "price": "49.00"?

The code can be found here: https://pastebin.com/BCxh1nmT

1 Answers1

1
 $var = json_decode ($output, true);

will produce $var array with values from your JSON. Then use it as usual array to get needed information like:

 print $var["price"];
diavolic
  • 722
  • 1
  • 4
  • 5