cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

COOKIE question

From: Dimitris Tripakis <DTripakis_at_pathfinder.gr>
Date: Thu, 2 Sep 2004 00:27:30 +0300

Hello all,

I use this code to post XML to a server :

curl_setopt($ch, CURLOPT_URL, "https://some.url.gr/");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml; charset=UTF-8"));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //Disable server authentication
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //This makes curl_exec() to return a string with the response
curl_setopt($ch, CURLOPT_POST, 1); //Default is GET, so we must set this.
curl_setopt($ch, CURLOPT_HEADER, 1); //Make sure the header is included in the response

Now this works Ok, notice that CURLOPT_HEADER is 1,
so that the header is returned. Now the server returns this :

HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=8A3785A7E966DB53416E3A0085FD33A6; Path=/epp; Secure
Content-Type: text/plain
Transfer-Encoding: chunked
Date: Wed, 01 Sep 2004 21:12:52 GMT
Server: Apache Coyote/1.0

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
....more xml here................

Now I need to get the cookie and parse the xml,
so the questions are :

1. As far as I can see, we can only "include header
in the response" or not. What if I need both but
prefer them separately ? Is there a way to get
the header separately ? (I know its no big deal
to do it, but the code will look smarter also).

2. Is there a way to get the COOKIE without parsing
the header ? (e.g. with some CURLOPT_ option ? )
>From what I can tell, CURLOPT_COOKIE etc are for
sending cookies, not retrieving them.

Well thats all thanx very much,

Dimitris

______________________________________________________________________________________
http://mobile.pathfinder.gr - Pathfinder Mobile logos & Ringtones!
http://www.pathfinder.gr - Δωρεάν mail από τον Pathfinder!
Received on 2004-09-02