Post
Topic
Board Project Development
Re: Need help about PHP and API
by
paraboul
on 27/09/2017, 13:31:19 UTC
Quote
Both codes work
but I am not able to replace :
$data = '{"success":true,"name":"winspiral","total":196864,"withdrawn":0,"balance":196864}';
by
 
$data='$file';
why?

Because :

1. If $file contains the JSON, it must be either just $file (no quote, or double quote instead of single) or just use $file as the data.
2. If you want to read the data from a file, use something like $data = file_get_contents($path_to_file) (or whatever is the API you get your JSON from)

Anyway, this is very basic programming. If you're planning to deal with other people money, you shouldn't do this yourself.