Jump to content

Curl Function Problem


bharan_n

Recommended Posts

have written a Curl function to crawl a website. I was able to login and storing the cookie in a file.

 

I am trying to initiate a new curl and tried to use the same cookie to login.

 

It is not logging in and again asks for username and password.

 

I am actually trying to crawl the content.I can login but i am not able to crawl the contents.

 

it is for a vb forum i tried.

 

i can post the site name. but i am not sure whether i can post here or not.

 

If you can post any help related to it.

Link to comment
https://forums.phpfreaks.com/topic/134524-curl-function-problem/
Share on other sites

I am not an asshole. May be you. who knows.

 

And you see my reply. I said do i need to post any more information.

 

Code.

 

$username = 'johny';

$password = 'lak8shmi';

 

$post_fields =array(

'vb_login_username' => $username,

'vb_login_password' => $password,

'do' => "login",

's' => '',

);

$lurl = "http://www.indiancinemafans.com/board/upload/login.php";

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$lurl);

curl_setopt($ch, CURLOPT_POST, 4);

curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);

curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch,CURLOPT_COOKIEJAR,"cookie1.txt");

$result= curl_exec ($ch);

curl_close ($ch);

echo $result;

$forumid = 11;

preg_match('%name="securitytoken" value="(.*)"\ /\>%',$result,$security123);

 

the above code shows the vb user was successfully logged in.

 

After that it is redirecting to index.php

 

but afer redirecting it is asking for username and password again.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.