itunes api search term file_get_contents

Discussion in 'PHP' started by Ledz, Jan 13, 2017.

  1. #1
    I have strange issue about getting info from itunes api.
    So in my error log is written :
    "PHP Warning: file_get_contents(https://itunes.apple.com/search?term=the-bouncing-souls&limit=1&media=music&entity=song): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden"
    But when i enter this link in adress bar its getting me content.
    Also in my site when i reload page two tree times its getting me content but in first time it getting me this forbidden error.
    why?

    down is my code :
    $response = json_decode(file_get_contents('https://itunes.apple.com/search?term='.$iartist.'&limit=1&media=music&entity=song'));
     
    Ledz, Jan 13, 2017 IP