Hi all
I want to use variables in file_get_contents but it doesn’t work.
Only example 1 works, on my host or on my own machine running lamp server. I need either example 2 or 3 to work.
I have searched the internet, but it doesn’t seem to be a problem for anyone else.
I don’t get any error messages when I use examples 2 and 3, error messages are turned on, but i dodn’t get any data either.
The data is there, pasting the url in my browser shows it.
Many thanks for reading this.
example 1
[code=php]$json = file_get_contents(“http://somesite.com/products.json;orderBy=priceAsc;pageSize=20”,true);
example 2
[code=php]$GetURL = “http://somesite.com/products.json;orderBy=priceAsc;pageSize=20”
$json = file_get_contents($GetURL,true);
example 3
[code=php]$OrderBy = “priceAsc”;
$PageSize = “20”;
$json = file_get_contents(“http://somesite.com/products.json;orderBy=”.$OrderBy.”;pageSize=”.$PageSize,true);