On 01/13/2012 04:27 PM, Marco wrote:
It works! Thanks.
I've also tryed doing append (instead of assign) in my c++ string and
it also worked just fine!
On 01/13/2012 07:42 AM, Dan Fandrich wrote:
On Fri, Jan 13, 2012 at 07:16:29AM -0200, Marco wrote:
I'm having trouble with the page content retrieved when I use
"curl_easy_perform(curl);", basically, every time I try to get a page
from a localhost, everything goes right, don't matter how big the
page is.
But when I try in any remove server, even google, only the very-end
of page (at about 100 bytes) is returned to the buffer variable.
That's because the write callback is called many time, each time with
another small piece of data. Take a look at the getinmemory.c example
program to see how to properly download a URL into a memory buffer.
Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Hello again, my CURLOPT_WRITEFUNCTION function is working just fine to
write on buffer with any HTML page, but when I try to do it with any XML
page, it simply cut off the very beginning of the page.
CURLOPT_WRITEFUNCTION is writer(char *data, size_t size, size_t nmemb,
std::string *buffer)
I've took to stdout every char*data that curl inserted in the function,
but i didn't showed the beginning of the xml source. Like this:
int curlWrapper::writer(char *data, size_t size, size_t nmemb, string
*buffer)
{
puts(data);
buffer->append(data);
return size * nmemb;
}
Even when I try setting CURLOPT_FOLLOWLOCATION to 1, the buffer variable
simply skip the beginning of the xml page like that:
HTTP/1.1 200 OK
Date: Sat, 14 Jan 2012 11:25:16 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Set-Cookie: ASP.NET_SessionId=j0pegezsrkktzj45crfa0gea; path=/
Cache-Control: private
Expires: Sat, 14 Jan 2012 11:25:15 GMT
Content-Type: text/xml; charset=iso-8859-1
Content-Length: 1496
Sabado><Erro>0</Erro><MsgErro></MsgErro></cServico><cServico><Codigo>41068</Codigo><Valor>7,86</Valor><PrazoEntrega>4</PrazoEntrega><ValorMaoPropria>0,00</ValorMaoPropria><ValorAvisoRecebimento>0,00</ValorAvisoRecebimento><ValorValorDeclarado>0,00</ValorValorDeclarado><EntregaDomiciliar>S</EntregaDomiciliar><EntregaSabado>N</EntregaSabado><Erro>0</Erro><MsgErro></MsgErro></cServico></Servicos>
Does anyone know the reason for that behaviour?
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html