input: Write a function to scrape an online news website to get the headlines. The function should take the URL of the website as input, use the requests library to get the HTML content, and then parse the content using BeautifulSoup to extract and print the headlines which are typically wrapped in 'h2' tags.
  assert scrape_headlines("https://www.news.com/")==["Headline 1: Breaking News", "Headline 2: Politics", "Headline 3: Sports"]
  assert scrape_headlines("https://www.anotherews.com/")==["Top News: World", "Local News: City"]
  assert scrape_headlines("https://www.invalidnews.com/")==[]
  assert scrape_headlines("https://www.emptynews.com/")==[]
output: def scrape_headlines(url):
      import requests
      from bs4 import BeautifulSoup
      try:
          response = requests.get(url)
          response.raise_for_status()
          soup = BeautifulSoup(response.text, 'html.parser')
          headlines = [h2.text for h2 in soup.find_all('h2')]
          return headlines
      except:
          return []