473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

set_cookie?

31
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. use LWP::UserAgent;
  3. use HTTP::Cookies;
  4. use strict;
  5. my $ua = LWP::UserAgent->new();
  6. my $cookie_jar = HTTP::Cookies->new();
  7. $ua->cookie_jar( $cookie_jar );
  8. $cookie_jar->set_cookie(
  9.   1,                     # version
  10.   'username',            # key
  11.   'jack',           # value
  12.   '/',                   # path
  13.   'http://www.example.com', # domain
  14.   '',                    # port
  15.   0,                     # path_spec
  16.   0,                     # secure
  17.   999999,                # maxage
  18.   0,                     # discard
  19.   {}                     # rest
  20.   );
  21. my $res = $ua->get("http://www.example.com/");
  22. if ($res->decoded_content=~/Your name is = (\w+)/i){
  23. print "name = $1";
  24. }
This script is supposed to log me on in some site, but when i compile it, it prints "name = null". Null would be default value for "Your name is = " in that site. Whats wrong in this script?
Nov 26 '08 #1
0 3040

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: lucanos | last post by:
Hey All, Just wondering whether there is an abbreviated "If - Then - Else" format in PHP, much like that possible in JavaScript. JavaScript allows an abbreviated version in the following...
1
by: Robert Kattke | last post by:
I'm designing a site for local music and entertertainment and have a few ?s that need to be cleared up. Currently, I'm working on the Club part and have a Contact Person form, and a Club form. ...
3
by: Tom Cahill | last post by:
The following code will work perfectly on a PC browser, IE or Netscape. However on a Mac browser (IE, Netscape, or Safari) it does not. I have tried it on OSX and OS9. ANy help anyone can offer...
9
by: Christopher Benson-Manica | last post by:
I have the following situation: Page A opens a window named 'foo'. Page A then reloads itself. Is there a way for the reloaded Page A to determine whether there is an open window named 'foo',...
10
by: Joseph S. | last post by:
Hi, How do I pass a string from one call to a php block to another call in the same page but from another form? Here's my full php code: I'm using two forms in the same page. A hidden field...
7
by: Japhy | last post by:
Hello, I need to save values typed into forms across several scripts, before the user actually 'submits' the form to update the mysql db. I have been exploring ways to do this, and looking for...
32
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
2
by: Larry Bates | last post by:
I'm struggling with a project using mechanize and cookies to screen scape a website. The site requires a client created cookie for authentication. Below is the code I'm attempting to use with the...
2
by: riddhibhatia | last post by:
Hie....my set_cookie function is not working. I dont know why it is happening as there is no error also...i am setting it through javascript....... var live_element; function fokus(ele,path) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.