Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-04-2009, 07:55 AM   PM User | #1
java_freak
New Coder

 
Join Date: Nov 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
java_freak is an unknown quantity at this point
Smile PHP curl help

i donno whether my question has issues here
i want to login www.codingforums.com via php curl
the code i was using is :
PHP Code:
<?php
$url 
"http://www.codingforums.com/login.php?do=login";
$postfields "vb_login_username=java_freak&vb_login_password=&s=&securitytoken=&do=login";
$cookie_file_path "cookiejar.txt";
$fp fopen("$cookie_file_path","w") or die("<BR><B>Unable to open cookie file $mycookiefile for write!<BR>");
fclose($fp);
    
$agent "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL,$url);
    
curl_setopt($chCURLOPT_POST1);
    
curl_setopt($chCURLOPT_POSTFIELDS,$postfields);
    
curl_setopt($chCURLOPT_USERAGENT$agent);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt($chCURLOPT_FOLLOWLOCATIONTRUE);
    
curl_setopt($chCURLOPT_COOKIEFILE$cookie_file_path);
    
curl_setopt($chCURLOPT_COOKIEJAR$cookie_file_path);
    
$result curl_exec ($ch);
    echo 
$result;
    
    
curl_close ($ch); 
    
?>
i'm using Tamper data plugin for FireFox to get the post data..
do the datas that i supplied earlier is enough?
when i execute the script it says "Login successful. redirecting.."
but after redirecting it returned to the front page
can someone point me how to use cookies correctly(if thatz the case).
or a working example i just wanna learn how it's done
any lead is greatly appreciated
java_freak is offline   Reply With Quote
Old 11-04-2009, 08:34 AM   PM User | #2
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
and what will you be wanting our lovely coding forum's (notice the single quote, used for a certain reason) data for?
__________________
Website Design Mansfield
PHP Code:
function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
echo 
I_LOVE(); 
Phil Jackson is offline   Reply With Quote
Old 11-04-2009, 09:50 AM   PM User | #3
java_freak
New Coder

 
Join Date: Nov 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
java_freak is an unknown quantity at this point
Quote:
Originally Posted by Phil Jackson View Post
and what will you be wanting our lovely coding forum's (notice the single quote, used for a certain reason) data for?
i don't have any bad intentions ..just want a working example..
it's fine if u give me any other working examples that uses cookie to login using curl
java_freak is offline   Reply With Quote
Old 11-04-2009, 10:37 AM   PM User | #4
java_freak
New Coder

 
Join Date: Nov 2009
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
java_freak is an unknown quantity at this point
any working examples which uses cookies in curl login..please
java_freak is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:14 PM.


Advertisement
Log in to turn off these ads.