If you ever need to cUrl into admin... here it is

Curling into admin is nothing to do (you must have some curl experience though). Once you log-in, keep the cookie file and browser agent for other interactions.



You may need to set a full path to your cookie file depending on your php setup.

Edit post data for your own login info, don’t forget to urlencode it.


<br />
<br />
$url='https://mysite.com/admin.php';<br />
$post_data='return_url=admin.php&user_login=user%40blah.com&password=letmein&dispatch%5Bauth.login%5D=Sign+in';<br />
$cookie='my.c';<br />
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"; <br />
$referrer='https://mysite.com/admin.php';<br />
<br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_URL,$url);<br />
curl_setopt($ch, CURLOPT_REFERER, $referrer);<br />
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);<br />
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);<br />
curl_setopt($ch, CURLOPT_POST,1);<br />
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);<br />
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);<br />
curl_setopt($ch, CURLOPT_HEADER,0);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);<br />
curl_setopt($ch, CURLOPT_COOKIEJAR,$cookie);<br />
curl_setopt($ch, CURLOPT_COOKIEFILE,$cookie);<br />
$out = curl_exec($ch);<br />
echo $out;<br />

```<br />
<br />
This should echo your admin page without css and pics.

I found an easy way to add options to items in bulk and this is the first step in my grand plan.



EDIT (here is the code):



Sure, you curl login first and keep cookie info.



$item - id of the product to which to add an option

$option - id of the option which to add

$times - how many times (useful if adding NOT as a link);

$g - Glogbal or not, must be ‘Y’ for yes



```php

function add_option($item,$option,$times=1,$g=‘N’){

$post_data=“product_id=$item&selected_section=options&global_option%5Bid%5D=$option&global_option%5Blink%5D=$g&dispatch%5Bproducts.apply_global_option%5D=Apply”;

$url=‘https://yoursite.com/admin.php’;

$cookie=‘my.c’;

$useragent=“Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1”;

$referrer=‘https://yoursite.com/admin.php?dispatch=products.update&product_id=’.$item;

for($i=0;$i<$times;$i++){

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$url);

curl_setopt($ch, CURLOPT_REFERER, $referrer);

curl_setopt($ch, CURLOPT_USERAGENT, $useragent);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);

curl_setopt($ch, CURLOPT_POST,1);

curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);

curl_setopt($ch, CURLOPT_HEADER,0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch, CURLOPT_COOKIEJAR,$cookie);

curl_setopt($ch, CURLOPT_COOKIEFILE,$cookie);

$out = curl_exec($ch);

unset($ch);

sleep(2);

}

}



```