cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Downloading a report from reporting services using curl

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 23 Feb 2011 23:30:18 -0800

On Wed, Feb 23, 2011 at 02:26:57PM -0800, Amit Valia wrote:
> I'm trying to use CURL download reports from the reporting services URL.
>
> I can pass all the parameters of the report directly in the URL such
> that I can download that report into a PDF doc
> (...&rs:Format=PDF&Manager=XXX&Portfolio=XXXX&CurrentReportDate=12/31/2010).
> When I type that URL straight into the browser, it immediately prompts
> me to open or save the PDF file.
>
> But when I pass this URL through cURL, it gives me an error.
>
> My output file shows me the following.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
> 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
> <HTML><HEAD><TITLE>Bad Request</TITLE>
> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
> <BODY><h2>Bad Request</h2>
> <hr><p>HTTP Error 400. The request is badly formed.</p>
> </BODY></HTML>
>
> Is CURL not suitable for such requests?

It likely is, when used correctly.

> I've been using wget but it is not working with the SQL server 2008
> R2. Hence I was testing to see if cURL will.
>
> Here's the command.
>
> I:\Reports>curl -u user:pwd -o "test.pdf" "http://xxxx/reportserver?/folder/xxxxxxxxStatement&rs:Format=PDF&Manager=XXX&Portfolio=1111&CurrentReportDate=12/31/2010 12:00:00 AM&PreviousReportDate=12/31/2009 12:00:00 AM"
>
> I'd really appreciate if you could help me.

Thta URL is invalid because it contains space characters. Those need to be
URL escaped to become %20.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-24