cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How can i get the answer from a post ?

From: Jabka Atu <mashrom.head_at_gmail.com>
Date: Tue, 29 Jul 2008 00:00:31 +0300

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nikolai Kondrashov wrote:

> Jabka Atu wrote:
>> and the url is "http://pastebin.com/pastebin.php"
>> How can i get the answer of this message? .
> Are you sure that the site doesn't answer with 30x response? Because in
> that case you could receive no data and you may need to use
> CURLOPT_FOLLOWLOCATION option to get to the actual response.
>
> Sincerely,
> Nick
>
I found the ans :
After i do the easy_perform that send the POST i need to switch to GET
(curl_easy_setopt (CURL * curl_handler, CURLOPT_HTTPGET, 1L) ) and the
do another easy perform.

So in my case :
       .
       .
       .
  curl_easy_perform(curl_handler);
  curl_easy_setopt ( curl_handler, CURLOPT_HTTPGET, 1L);

  curl_result = curl_easy_setopt(curl_handler,
CURLOPT_WRITEFUNCTION,write_to_buffer);
  if (curl_result != CURLE_OK) {
    fprintf(stderr,"Failed to set CURLOPT_WRITEFUNCTION, the error
was : %s" , errorBuffer);
    return -1;
  }

  curl_result = curl_easy_setopt(curl_handler, CURLOPT_WRITEDATA,
&buffer);
  if (curl_result != CURLE_OK) {
    fprintf(stderr,"Failed to set CURLOPT_WRITEHEADER, the error was
: %s" , errorBuffer);
    return -1;
  }

  header.clear();
  curl_result = curl_easy_setopt ( curl_handler, CURLOPT_WRITEHEADER,
&header);
  if (curl_result != CURLE_OK) {
    fprintf(stderr,"Failed to set CURLOPT_WRITEHEADER, the error was
: %s" , errorBuffer);
    return -1;
  }

 curl_easy_perform(curl_handler); /* post away! */

- --
- ---==== Jabka Atu ===---
    bsh83.blogspot.com
- ---=== Encryption is a way of life ===---
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBSI4zb5zNKvbZ7QAsAQL4Kg/9HleSa1P3vTIgmRNMpAUF9szTS6+ayZB+
GewomuubxZskaA9LbFpcwBIygp6mHweZa51yXLhp6lkRIbAS+9A209EdGe4+b8Vd
452pkMh51YChP+xaDoJybA9iwY2OrMwzXI3LL6auuaOGXLDcQbUUMCUBngV3kgth
DnbE8tGgAh7CECVvMzXN1am/jXO+XDoFA8QrNtl8olqd+xtJpOdo0pGQzRDizK22
eyK727PdxmR5n6LmIz2WTLbCXzPfIsb2lIMT3IOP5nrleun9KXBWYyhX+IcaRIMg
bq5iZpC0E/R/d1QvxvcmEfGJ3MrMWe0RklyqQ6exUbUoqUh3lSGFgqI0ziHfa7lw
sOjqqweYnfecXwU5U7GD+37YGhB5SpTcOBGNOcI4UL9KlufzJ549K2WKRfCm9r1k
+4sRJRwKKrwLQvJFu6dYn/18iA6zXK51VXSfwwXx/GQGZ2e8hLnJNppqI30vzNto
yMPhIG+jEcU94mqu6e6XLA2v81O5xzhLDzTOAVBMQkfvjUul1U50PK/Z0wCmESeJ
1qXv+cYeR/tUF9x1FdWNfllW7NA89nTelCPL0d4GEeIgYl7bQN6owPo70G4GeLCs
yup3FdNQCHmfgpE6rU61/su1IL0aNCsJM/aS/yPi5UBw779via1Xfffeod7wO0hT
/R7AZzjlR1k=
=r1bF
-----END PGP SIGNATURE-----
Received on 2008-07-28