curl only write to file if successful status 200

Make curl get the contents of a URL and write to file, but only write to file if the response is successful:

curl -s -S -f -o facebook-feed.json "$facebook"
If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom)