fork(3) download
  1. <?php
  2.  
  3. $url = 'http://m...content-available-to-author-only...l.com/my doc with more white spaces.doc';
  4. $purl = parse_url($url);
  5. $rurl = "";
  6. if(isset($purl['scheme'])){
  7. $rurl .= $purl['scheme'] . "://";
  8. }
  9. if(isset($purl['host'], $purl['path'])){
  10. $rurl .= $purl['host'] . rawurlencode($purl['path']);
  11. }
  12. if($rurl === ""){
  13. $rurl = $url;#error parsing error/invalid url?
  14. }
  15. echo $rurl;
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
http://m...content-available-to-author-only...l.com%2Fmy%20doc%20with%20more%20white%20spaces.doc