input: Write a function to collect all the links from a given website URL. The function should return a list of all the URLs found on the webpage. If the URL is not valid or no links are found, return an empty list.
  assert collect_links("http://www.example.com/") != []
  assert collect_links("http://www.invalidurl.com/") == []
  assert collect_links("") == []
  assert collect_links("http://www.example.com/no_links") == []
output: import requests
  from bs4 import BeautifulSoup
  
  def collect_links(url):
      try:
          response = requests.get(url)
          if response.status_code != 200:
              return []
          soup = BeautifulSoup(response.text, 'html.parser')
          links = [a['href'] for a in soup.find_all('a', href=True)]
          return links
      except:
          return []