SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict ArunB's Avatar
    Join Date
    Jun 2008
    Location
    Hyderabad
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Maintaining session in cURL

    I am sending a request to a server A. There, in the server I am using cURL to send request to a page on the same server(A). So, I am sending a request from A to A.

    As I log into A, session will be established. Can't I use the same session for cURL requests going from A to A?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you can. Look at the "cookie" options that you can set using curl_set_opt.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Location
    England
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have a look at
    CURLOPT_COOKIEFILE & CURLOPT_COOKIEJAR

    http://uk3.php.net/curl-setopt

  4. #4
    SitePoint Addict ArunB's Avatar
    Join Date
    Jun 2008
    Location
    Hyderabad
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CURLOPT_COOKIEFILE: The name of the file containing the cookie data. The cookie file can be in Netscape format, or just plain HTTP-style headers dumped into a file.

    But how can we know the name of the cookie on the client side? Can we use the same cookie in the server side cURL requests also?

    A session will be created when client sends a request to server A. The same session should be used for the requests that are sent (using cURL) from A to A. Otherwise data will not be returned in the requests going from A to A.
    Last edited by ArunB; Sep 16, 2008 at 05:12.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •