Jump to content

how login to Administration panel via curl


justin221

Recommended Posts

You certainly missed something because that is pretty straight-forward.

curl --silent --junk-session-cookies --cookie-jar cookie-jar.log \

--form-string Submit=Connexion --form-string [email protected] --form-string passwd=passwd \

--output - http://www.example.c...store/login.php

curl --silent --cookie-jar cookie-jar.log \

--form virtual_product_file=@_pkg_/${module.name}_${module.version}.tar.gz \

--output - http://www.example.c...ProductFile.php

... rest of your BO processing ...

 

I use this to automatically my package update to my shop. NOTE: the snippet is incomplete

 

Hope this helps.

Best,

(d)oekia

 

thanks for your reply soon ~

 

 

<?php
$login_url		=	'http://www.example.com/admin_example/login.php';
$passwd="######";
$email="[email protected]";
$post_fields	= 'passwd='.urlencode($passwd).'&email='.urlencode($email);



$ch = curl_init($login_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_exec($ch);
curl_close($ch);


$in_url='http://www.example.com/admin_example/index.php';
$ch = curl_init($in_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$contents = curl_exec($ch);
curl_close($ch);
?>

 

diference method

 

can you tell me what is problem about this code ?

Link to comment
Share on other sites

(d)oekia, I tried your code in a .sh file, and is not seems to login successfully. I only need to login on my store's admin area and then to access a link (that link, once "pressed" will import the new up-to-date inventory to the shop). Do you have any idea?

Link to comment
Share on other sites

Souds like you will have a lot to do for what seems to be a simple click. Import means posting a file, then posting all fields ... I guaranty you that the method expressed thru shell, is working, I use it everyday.

 

Making it to work for your needs could be pretty time consuming. Sorry not to have time to support you on this.

 

I modified the AdminImport tab, in order to take automatically the source file and the configuration of the import. Normally, we must go to the import section, select the file to import, the file type, after that - on the next page - the columns. I do all these by accessing my custom made AdminImportCombinations tab. That's why I was telling that I only need to login and "click" a link. In my case, the link is: [ http://www.myshop.com/admin/index.php?tab=AdminImportCombinations ] This link will made everything for me. But I'm stuck exactly at the login phase. So my question: should I put the two lines each one in a cron command, or both of them in a .sh file? Thank you for providing the first info on this matter!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...