Fix curl error when url contains #fragment.
Change preg_replace to substr+strpos.
Merge pull request #457 from Thinkscape/curl-error-url-with-fragment

Fix #453 - curl error when url contains #fragment.