get main url part of big link
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/10140504/get-part-of-url-in-php">Get part of url in php</a>  </p>
</blockquote>



<p>i want to get <code>http://aoup.net/manage/preForm/test.php</code> </p>

<p>from this url </p>

<pre><code>http://aoup.net/manage/preForm/test.php?op=Results&amp;form_id=1&amp;form_name=%D8%A7%D9%86%D8%AA%D8%AE%D8%A7%D8%A8%20%D8%AD%D9%88%D8%B2%D9%87%20%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%DB%8C%28%D8%AF%D9%88%D8%B1%D9%87%20228%29&amp;hash=406ce38266577b8dff3102e476fdf587
</code></pre>

<p>this my php code not work correctly:</p>

<pre><code>echo 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
</code></pre>
