How do I publish WODs with ExpressionEngine?

Follow

Leverage Wodify's API to post WODs to your ExpressionEngine site.  Below is a php example:

<?php    
  if(!class_exists('GetWOD')) {        
    class GetWOD {            
      public $APIKey;            
      public $Date;            
      public $LocationText;            
      public $ProgramText;
             
      function __construct($apikey, $date, $locationtext, $programtext){         $this->APIKey = $apikey;                
        $this->Date = $date;                
        $this->LocationText = $locationtext;                
        $this->ProgramText = $programtext;            
      }        
    }    
  }
     
  $SOAPClient = new SoapClient("http://app.wodify.com/API/WOD_v1.asmx?wsdl", array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));    
 
  // Call RemoteFunction ()     
  $error = 0;    
  $soapResponse = "";    
  try {        
    // CHANGE THE 'API KEY', 'LOCATION NAME', AND 'PROGRAM NAME' BELOW TO THE CORRECT VALUES!        
    $soapResponse = $SOAPClient->GetWOD(new GetWOD('API KEY', '{entry_date format="%Y-%m-%d"}', 'LOCATION NAME', 'PROGRAM NAME'));    
  } catch (SoapFault $fault) {        
    $error = 1;        
    print("Sorry, GetWOD returned the following ERROR: ".$fault->faultcode."-".$fault->faultstring);    
  }      
  if ($error == 0) {        
    if (is_null($soapResponse)) {            
      print("NULL response");        
    } else {            
      print($soapResponse->WOD->FormattedWOD);            
      print("<p><a href=\"https://app.wodify.com/PerformanceTracking/PublicWhiteboard.aspx?WhiteboardKey=mg4w0xd3xl&Date={entry_date format="%Y-%m-%d"}&ProgramName=CrossFit&LocationName=CFA\" target=\"_blank\"><img src=\"http://akroncrossfit.com/images/theme/wod-results-btn.png\" /></a></p>");        
    }    
  }
?>

Comments