save session (cookies)

Posted on 2005-04-29
Last Modified: 2006-11-18
I want to code 1 page which can do
 + Login into a website with my account.
 + Get data from this site which was login.

Ex, I want this page can  :
  + login into a forum, then get post data of this forum.

How can I do that ?
please help me
Question by:ngocquynh85
    LVL 6

    Accepted Solution

    Hi ngocquynh85,

    Basically, you will need to use fsockopen() ( to open connection.
    Then you will need to create POST request with your login name and password.
    Then you send this request to website and capture output, watching for Set-Cookie: headers.
    You collect all those cookies and create another request, in which you include those cookies.
    And then capture output again and hope it's not gzipped :-)

    It's probably a lot of work, I recommend you not to write it yourself but try PEAR HTTP Packages:

    German Rumm.

    Author Comment

    please tell me more detail ??? or example.
    LVL 14

    Expert Comment

    No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
    I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: German_Rumm

    Any objections should be posted here in the next 4 days. After that time, the question will be closed.

    EE Cleanup Volunteer

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    This is a general how to create your own custom plugin system for your PHP application that you designed (or wish to extend a third party program to have plugin functionality that doesn't have it yet).  This is not how to make plugins for existing s…
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now