Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 29th, 2005, 12:56 AM
Authorized User
Points: 138, Level: 2
Points: 138, Level: 2 Points: 138, Level: 2 Points: 138, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: McHenry, IL, .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Server acting as browser - handling cookies?

I need to have my Apache/PHP 4.3.0 server act as a client browser and navigate to a restricted site that uses session cookies. The PHP script needs to:

1. Login:
    $url_login = 'https://www.secure.com/scripts/cgi.exe/uv.w?request=login&login=myaccount&password=mypass word';
    copy($url_login,$response_file);

2. Gather data and process:
    $url_data = 'https://www.secure.com/scripts/cgi.exe/uv.w?request=getdata&index=3';
    copy($url_data,$data_file);
    process_data($data_file);

3. Logout:
    $url_logout = 'http://www.secure.com/bye.asp?request=logout';
    copy($url_logout, $response_file);

Steps 1 and 3 work fine since they don't require session cookies. Step 2 fails since session cookie info is not stored by step 1 and subsequently sent in the HTTP header of the 'copy' function in step 2.

Questions:

1. How can step 1 get the HTTP header cookie information from the 'copy' request? (or suggested equivalent functionality).

2. How can step 2 supply the HTTP header cookie information in the 'copy' request? (or suggested equivalent functionality).

TNX for your help.

Philibuster
__________________
Philibuster
Reply With Quote
  #2 (permalink)  
Old August 15th, 2006, 09:39 PM
Authorized User
Points: 138, Level: 2
Points: 138, Level: 2 Points: 138, Level: 2 Points: 138, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: McHenry, IL, .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The best solution to this requirement appears to be LibCurl. It will handle most of the HTTP functionality including cookies.

Philibuster
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Chap 2) problem with cookies using safari browser Stephen Liggett BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 April 20th, 2006 11:25 AM
Handling Cookies rit01 ASP.NET 2.0 Basics 6 March 22nd, 2006 04:21 PM
handling script errors using vb web browser state Beginning VB 6 3 January 19th, 2006 09:01 AM
SQL Server sync with net server and browser server ne SQL Server DTS 0 June 13th, 2005 06:29 PM



All times are GMT -4. The time now is 11:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.