How do I pass a munchkin cookie through PHP SOAP call? | Community
Skip to main content
November 21, 2013
Question

How do I pass a munchkin cookie through PHP SOAP call?

  • November 21, 2013
  • 1 reply
  • 708 views
I am using the syncLead function and I don't know hwo to pass the munchkin cookie to the Marketo Service to track user usage.

I am converting the script from C# to PHP and in c# I see this

string munchkinCookie = string.Empty;
        if (HttpContext.Current.Request.Cookies["_mkto_trk"] != null)
        {
            munchkinCookie = HttpContext.Current.Request.Cookies["_mkto_trk"].Value;
        }
        ws_lead.marketoCookie = munchkinCookie;
        LeadRec.Email = lead.email;
        ws_lead.leadRecord = LeadRec;
        try
        {
            response = client.syncLead(ws_header, ws_context, ws_lead);
            results = "success";
            rs = response.result;
        }
        catch (Exception e)
        {
            results = e.Message;
            rs = null;
        }


So I thought I could do this in PHP but I haven't had any luck.
 $leadRecord = new stdClass();
      $leadRecord->leadRecord = $leadKey;
      $leadRecord->returnLead = false;
      $leadRecord->marektoCookie = $this->marketoCookie;
      $params = array("paramsSyncLead" => $leadRecord);
 
      //Make request
      $soapClient = new SoapClient($this->marketoSoapEndPoint  ."?WSDL", $this->options);
      try {
        $result = $soapClient->__soapCall('syncLead', $params, $this->options, $this->authHdr);
        if (is_soap_fault($result)) {
            trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
        }else{
         # echo 'Success';
        }
      }
      catch(Exception $ex) {
        var_dump($ex);
      }

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

November 21, 2013
*** PLEASE disregard, trash, DELETE!


I made a spelling mistake

$leadRecord->marektoCookie = $this->marketoCookie;

$leadRecord->marketoCookie = $this->marketoCookie;


yup..