PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
heya
Forum Newbie
Posts: 10 Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines
Post
by heya » Mon Nov 14, 2005 10:29 pm
feyd | Please use Code: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi, I am trying to create an auto log in script for http://www.12dailypro.com. code below:Code: Select all
<?php
$var1 = 'email@yahoo.com';
$var2 = 'password';
$site = "http://www.12dailypro.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"email=$username&passwd=$password&form='sent'");
curl_exec($ch);
curl_close($ch);
$direction = "http://www.12dailypro.com/members/?login=true&";
header("location: $direction");
?>
but i am not able to log in..
what is wrong with my code?
How can i make one that will enable me to log in the 12dailypro?
thanks.
feyd | Please use Code: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Nov 14, 2005 10:45 pm
$var1 vs $username
$var2 vs $password
heya
Forum Newbie
Posts: 10 Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines
Post
by heya » Mon Nov 14, 2005 10:49 pm
sorry i just typed it incorrectly. it should be
Code: Select all
<?php
$username = 'email@yahoo.com';
$password = 'password';
$site = "http://www.12dailypro.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"email=$username&passwd=$password&form='sent'");
curl_exec($ch);
curl_close($ch);
$direction = "http://www.12dailypro.com/members/?login=true&";
header("location: $direction");
?>
I'm getting:
I'm getting this page
Generated Tue, 15 Nov 2005 05:05:30 GMT by Prolexic.com (SICC2MIA1/1.0)
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Nov 14, 2005 10:58 pm
curl_exec() will echo the results of the request if you don't specify that it should "return transfer"
heya
Forum Newbie
Posts: 10 Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines
Post
by heya » Mon Nov 14, 2005 11:11 pm
what shall i do then?
i'm only getting this now.
Generated Tue, 15 Nov 2005 05:05:30 GMT by Prolexic.com (SICC2MIA1/1.0)
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Nov 14, 2005 11:34 pm
I was hinting at the curl option for returning the transfer
heya
Forum Newbie
Posts: 10 Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines
Post
by heya » Tue Nov 15, 2005 3:10 am
you mean setting the option to let the curl return the header?
sorry i really dont get it...
heya
Forum Newbie
Posts: 10 Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines
Post
by heya » Tue Nov 15, 2005 7:30 pm
anyone? help.