Solution: PHP code is run by Apache user (www-data on Ubuntu), so I had to move the netrc file to /home/www-data/, and add this curl option to my PHP code:
curl_setopt($ch, CURLOPT_NETRC_FILE, '/home/www-data/.netrc');
Search found 2 matches
- Thu Aug 03, 2023 10:45 am America/New_York
- Forum: Home
- Question: access denied when using netrc via php-curl on apache
- Replies: 2
- Tue May 16, 2023 5:36 pm America/New_York
- Forum: Home
- Question: access denied when using netrc via php-curl on apache
- Replies: 2
access denied when using netrc via php-curl on apache
So I'm following your directions on this page: https://urs.earthdata.nasa.gov/documentation/for_users/data_access/php And the netrc file I created works fine via command line (ubuntu): curl -O -b <path to cookies file> -c <path to cookies file> -L -n https://opendap.earthdata.nasa.gov/collections/.....