input: Write a function to scrape an online news website to get the headlines. If the website is unreachable or the input URL is not provided, return an empty list. If the headlines are successfully retrieved, return a list of headline strings. 
  assert scrape_headlines("https://www.news.com/")!=[]
  assert scrape_headlines("https://www.nonexistentwebsite.com/")==[]
  assert scrape_headlines("")==[]
output: import requests
  from bs4 import BeautifulSoup
  
  def scrape_headlines(url):
      if not url:
          return []
      try:
          response = requests.get(url)
          response.raise_for_status()
      except:
          return []
      soup = BeautifulSoup(response.text, 'html.parser')
      headlines = [h.text.strip() for h in soup.find_all('h1')]
      return headlines