Jump to content

Curl remote login question


djtozz

Recommended Posts

Hello,

 

I'm trying to make a remote login connection using curl for easy-share.com

 

I have follwing code:

 

<?php

$query = "login=test98&password=test98&remember=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.easy-share.com/accounts");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$query);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);

print 	$data;

?>

 

I created following test account:

user: test98

pass: test 98

 

The problem is following, I'm probably using the wrong CURLOPT_URL path to login:

http://www.easy-share.com/accounts

 

They are poping up the login window on their mainpage using a script.

See: http://easy-share.com/

Can somebody advice me how I can solve this?

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/182755-curl-remote-login-question/
Share on other sites

you can achieve this by this way also

may b this help you

 

 

<?php
// INIT CURL
$ch = curl_init();

// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'http://www.easy-share.com/accounts/login');

// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);

// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'login=test98&password=test98');

// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');

# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL
# not to print out the results of its query.
# Instead, it will return the results as a string return value
# from curl_exec() instead of the usual true/false.
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

// EXECUTE 1st REQUEST (FORM LOGIN)
$store = curl_exec ($ch);
// SET FILE TO DOWNLOAD
curl_setopt($ch, CURLOPT_URL, 'http://www.easy-share.com/accounts');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
// EXECUTE 2nd REQUEST (FILE DOWNLOAD
$content = curl_exec ($ch);
//echo $result;
curl_close($ch);
echo $content;

?>

  • 2 weeks later...

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.