I need to manipulate some data which is being given to me in json format, from which I need to extract some data and put into a variable in PHP.
Having tried my best, I seem to end up with errors such as :
Use of undefined constant collectionViewUrl - assumed 'collectionViewUrl'
At the moment the only real code I have is this:
$string = file_get_contents("https://itunes.apple.com/search?term=rihanna+diamonds&country=gb&media=music&entity=musicTrack&attribute=musicTrackTerm&limit=1");
$json_result = json_decode($string, true);
I do not need an array of any kind, I just need to put the value of collectionViewUrl into a variable.
$collectionViewUrlwithout the$signcollectionViewUrl.collectionViewUrlwas not quoted$json_result["collectionViewUrl"];also you were not looking in the correct array as noted in @Khaled Bentoumi answer.