cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: newbie question: URL encoding

From: mud honey <mudhoney1990_at_gmail.com>
Date: Thu, 10 Jul 2008 09:51:40 +1000

On Thu, Jul 10, 2008 at 9:25 AM, mud honey <mudhoney1990_at_gmail.com> wrote:

> On Wed, Jul 9, 2008 at 9:52 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
>> On Wed, 9 Jul 2008, mud honey wrote:
>>
>> I can do everything up to step 5 ok. The links on the index page are of
>>> the form
>>> http://somesite.com/blah/openfile.asp?crypt=%escape%sequenced%stuff
>>>
>>> Works fine in browser, can't get it to in cURL. I am using
>>>
>>> curl -b cookie "url_with_url%encoded%chars"
>>>
>>> I get back a bunch of binary crap that wrecks my linux terminal. It is
>>> definitely not the right stuff which is plain old HTML.
>>>
>>
>> That's probably not because if how you entered the URL. The URL needs to
>> be "URL escaped" - which means %-encoding of certain letters.
>>
>> If you don't get the same content with curl as with your browser, it is
>> usually rather a sign of the site detecting the user-agent and providing
>> different contents based on that. Like different user-agent, referer,
>> cookies or similar.
>>
>> --
>>
>> just so I'm sure I understand; you think I'm encoding the URL correctly,
> but there is another factor such as user-agent, cookies etc that may be
> causing the issue?
>

Actually I've solved this; I was reading the wrong bit of HTML and was
receiving back a PDF, hence the binary. I am now reading the correct link
and it works fine. Thanks for help and for providing such a great tool.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2008-07-10