HOME  FORUM  LINKS

Site Menu

Development

Director

Hosting Support

Quick Links

PHP

Some PHP snippets and applications supporting hosting functions in the CPANEL/WHM environment

AddEmail.PHP using curl

Download

* For the php file (Right-click and save) http://www.domaj.com/files/addemail.zip

ADDEMAIL.PHP V1.0js

<pre>
<?php
/*
    Simple example of creating a pop account using a PHP script
      Tony Domigan tony@domaj.com http://www.domaj.com Oct03

      Curl Modifications by James Shaver Feb06
*/

// Domain Logon Details
$username="xxxxx";
$password="xxxxx";

// Domain details
$domain="www.xxxxx.com";
$theme="xxxxx";//eg "fantastico_bluelagoon";

// Parameters to parse
$eEmail="xxxxx";
$eDomain="xxxxx.com";
$ePassword="xxxxxx";
$eQuota="xx"// eg"10";

// Put post fields variable together
$postfields "email=$eEmail&domain=$eDomain&password=$ePassword&quota=$eQuota";

// initialise Curl
$popPost curl_init();

// Set Curl Option: URL
$url="http://$domain:2082/frontend/$theme/mail/doaddpop.html";
curl_setopt($popPostCURLOPT_URL$url);

// Set Curl Option: Username:Password
curl_setopt($popPostCURLOPT_USERPWD"$username:$password");

// Set Curl Option: Post style request = true
curl_setopt($popPostCURLOPT_POST1);

// Set Curl Option: Collect result from script
curl_setopt($popPostCURLOPT_RETURNTRANSFER1);

// Set Curl Option: Set timeout to 15 seconds
curl_setopt($popPostCURLOPT_TIMEOUT15);

// Set Curl Option: Post data
curl_setopt($popPostCURLOPT_POSTFIELDS$postfields);

// Execute Request, and store result in $tb_post
$popPost_result curl_exec ($popPost);

// Close Curl
curl_close ($popPost);

      
//output results
      
$start strpos($popPost_result'<b>Account');
      
$end strpos($popPost_result'created.');
      
$subset substr($popPost_result$start$end+8-$start);
      
$subset str_replace('login '"login<br>"$subset); //for neatness
      //$subset=str_replace("<!",'<-',$subset); //see the comments
      
if (preg_match ('/Sorry/i'"$subset")) {
          print 
"<br><b>   Sorry that account already exists.</b><br><br>";
          
//print ($subset);
      
} elseif(preg_match ('/You must specify/i'"$subset")) {
          print 
"<br><b>You must specify a password.</b><br><br>";
      } else {
          print (
$subset);
          print 
"<br><br>You may now use <b>mail.$domain</b> as your POP3 setting in your mail client or access <b>WebMail</b> by selecting <a href=http://$domain/webmail>Here</a>.
              <center>
              <br><a href=javascript:history.go(-1)>Go Back</a>
              </center>"
;
      }
?>
</pre>

Recent Topics

The latest topics from the forum.

  1. k-director.com: Post Updates
  2. A blog about Adobe Director
  3. Centerstage
  4. Custom Cursor...Why It Does Not Work?
  5. Director Game!
  6. cross platform
  7. database xtra for both mac and windows
  8. from windows to MAC
  9. SLIDER POSITION...
  10. Bullet points in text member
  11. Any VideoOut plugin / xtras for director mx ??
  12. Activex component install
  13. quiz
  14. how to export embedded flash swf?
  15. A BIG PROBLEM...
  16. Spining a model on a touchscreen
  17. 3D Fountain trail to avoid the Cursor
  18. HTTP
  19. SHOCKWAVE VIDEO
  20. Deleting Lines Comparing Time...I Have No Idea...
  21. Property not found error
  22. SHOCKWAVE PROBLEM
  23. PROBLEM SHOCKWAVE
  24. text field focus
  25. ExitLock CloseRequest Quit Close Gadget
  26. convert read only
  27. F10 Key Code Does Not Work
  28. Director Game Development Survey
  29. baPrintFile()
  30. How do check if a printer is printing??

Useful Links

Google Translate
AltaVista Translate
Google Glossary

Google
Web www.domaj.com