Re: can i connect to marketo via shell script ?

Anonymous
Not applicable

can i connect to marketo via shell script ?

can i connect to marketo via shell script ?
Tags (1)
2 REPLIES 2
Anonymous
Not applicable

Re: can i connect to marketo via shell script ?

You can run a php (or equivalent) script from a shell script to achieve the same effect.  Something like: 

$php getlead.php

Sample getlead.php:

 

<?php
 
  $debug = true;
 
  $marketoSoapEndPoint     = "";  // CHANGE ME
  $marketoUserId           = "";  // CHANGE ME
  $marketoSecretKey        = "";  // CHANGE ME
  $marketoNameSpace        = "http://www.marketo.com/mktows/";
 
  // Create Signature
  $dtzObj = new DateTimeZone("America/Los_Angeles");
  $dtObj  = new DateTime('now', $dtzObj);
  $timeStamp = $dtObj->format(DATE_W3C);
  $encryptString = $timeStamp . $marketoUserId;
  $signature = hash_hmac('sha1', $encryptString, $marketoSecretKey);
 
  // Create SOAP Header
  $attrs = new stdClass();
  $attrs->mktowsUserId = $marketoUserId;
  $attrs->requestSignature = $signature;
  $attrs->requestTimestamp = $timeStamp;
 
  $authHdr = new SoapHeader($marketoNameSpace, 'AuthenticationHeader', $attrs);
  $options = array("connection_timeout" => 20, "location" => $marketoSoapEndPoint);
 
  if ($debug) {
    $options["trace"] = true;
  }
 
  // Create Request
  $leadKey = array("keyType" => "EMAIL", "keyValue" => "t@t.com");
  $leadKeyParams = array("leadKey" => $leadKey);
  $params = array("paramsGetLead" => $leadKeyParams);
 
  $soapClient = new SoapClient($marketoSoapEndPoint ."?WSDL", $options);
  try {
    $lead = $soapClient->__soapCall('getLead', $params, $options, $authHdr);
  }
  catch(Exception $ex) {
    var_dump($ex);
  }
 
  if ($debug) {
    print "RAW request:\n" .$soapClient->__getLastRequest() ."\n";
    print "RAW response:\n" .$soapClient->__getLastResponse() ."\n";
  }
 
  print_r($lead);
 
?>
Anonymous
Not applicable

Re: can i connect to marketo via shell script ?

So if i understand u well , Marketo don't provide any method for curl...  can we use curl to post data in Marketo ?