input: Write a function to create a web crawler in Python that starts from a given URL, finds other links on the page, and scrapes the content of the page. The function should use a breadth-first search approach to visit all linked pages starting from the initial URL. If the input URL is invalid, the function should return an error message.
  assert crawl('http://example.com')==None
  assert crawl('http://invalidurl')=='Invalid URL or connection failed'
  assert crawl('')=='Invalid URL or connection failed'
output: def crawl(url):
      import requests
      from bs4 import BeautifulSoup
      from urllib.parse import urljoin
      from collections import deque
  
      if not url:
          return 'Invalid URL or connection failed'
  
      try:
          response = requests.get(url)
          response.raise_for_status()
      except:
          return 'Invalid URL or connection failed'
  
      visited = set()
      queue = deque([url])
  
      while queue:
          current_url = queue.popleft()
          if current_url in visited:
              continue
          visited.add(current_url)
  
          try:
              response = requests.get(current_url)
              response.raise_for_status()
          except:
              continue
  
          soup = BeautifulSoup(response.text, 'html.parser')
          for link in soup.find_all('a', href=True):
              absolute_url = urljoin(current_url, link['href'])
              if absolute_url not in visited:
                  queue.append(absolute_url)
  
      return None