Jump to content

Curl empty spaces in url problem ??


lostnucleus

Recommended Posts

I have a url  such has

"http://google.com/this is a space here/and its a problem/music song.mp3 "

 

when i use it with curl to download such webpages using

curl_setopt($s,CURLOPT_URL,"http://google.com/this is a space here/and its a problem/music song.mp3 ");

 

I get some other page which is not i want but using my browser (opera) i get wat i want with the same url ??

 

Thanks In Advance :) !!

 

 

Link to comment
Share on other sites

EDIT:

 

Post the actual url not some http:// this is a weird site url that i cannot just write http://www.site.com/file.mp3

 

That will get you more help than anything.

 

My bet is your are urlencoding the whole url, you should only do this for the name of that file without the extension. http://www.google.com/(your file name needs to be encoded).mp3

 

Link to comment
Share on other sites

actually...you probably need this OPT:

curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);

 

another note...rawurlencode() is for the parts, not the whole string:

$url = 'http://google.com/'.rawurlencode('this is a space here').'/'.rawurlencode('and its a problem').'/'.rawurlencode('music song.mp3');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.