I am looking to build a module that needs to do POST actions then handle the response details.

I understand how to do this from the frontend but am unsure how to fully implement this within the dashboard. Are there any simple examples of this you could provide or recommend an extension that performs similar actions I could look at?

1 Answer 1


Example using CURL:

$url = 'https://example.org/connector.php';
$postData = array();
$postData['var2'] = join(',', $emails);
$postData['var3'] = 'amasty';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);

if (strlen($result) > 2){
   //do something 


You can use this code in admin controller created by this tutorial http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table

  • Hello, Thank you for the reply. I know how to do this part, the problem is i am unsure how to properly implement it into the magento dashboard. I am familiar with doing it on the frontend but found few examples of creating a dashboard module with external functions only internal settings/actions. Commented Aug 2, 2014 at 20:44
  • Do you already have an admin controller that handles the get request? May be you can describe the task in more details?
    – Amasty
    Commented Aug 2, 2014 at 22:12
  • Hello, at the moment I just have a blank admin page following Alan Storms tutorial "Magento Admin Hello World Revisited" That is all I have built thus far. I have not created any controllers yet, i figured I would have to do so but don't fully understand the magento file structure. I am familiar with creating forms that submit post data but I am not sure how to implement this int he magento file structure if that makes sense? Commented Aug 4, 2014 at 4:22
  • Anyways, I have a blank admin page I am a little unsure of how to properly build the look and fields of it and unsure how to properly build an http post form that will call to an external database. Commented Aug 4, 2014 at 4:27
  • Have updated the answer.
    – Amasty
    Commented Aug 4, 2014 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.