title: Get protocol, domain, and port from URL
body: <p>I need to extract the full protocol, domain, and port from a given URL. For example:</p>
  
  <pre><code>https://localhost:8181/ContactUs-1.0/contact?lang=it&amp;report_type=consumer
  &gt;&gt;&gt;
  https://localhost:8181
  </code></pre>