var_dump($e); } // SOAPクライアントを作成します $parsedURL = parse_url($sforce_connection->getLocation()); define("_SFDC_SERVER_", substr($parsedURL['host'], 0, strpos($parsedURL['host'], '.'))); define("_WS_NAME_", "WS_TwilioDemo"); define("_WS_ENDPOINT_", 'https://login.salesforce.com/services/wsdl/class/' . _WS_NAME_); define("_WS_NAMESPACE_", 'http://soap.sforce.com/schemas/class/' . _WS_NAME_); $client = new SoapClient(WS_TWILIO_WSDL_FILE); $sforce_header = new SoapHeader(_WS_NAMESPACE_, "SessionHeader", array("sessionId" => $sforce_connection->getSessionId())); $client->__setSoapHeaders(array($sforce_header)); try { // GETされたユーザの入力を分割 // Parameterが無い場合は終了する if (empty($_GET['Digits'])) { echo "Oh! No Param."; return; } // call the web service via post $wsParams = array($_GET['From'], $_GET['answer1'], $_GET['Digits']); $response = $client->createQuestionnaire($wsParams); echo '<Response>'; echo '<Say voice="woman" language="ja-jp">セールスフォースに登録しました。アンケートの協力ありがとうございます。</Say>'; echo '</Response>'; // this is really bad. } catch (Exception $e) { global $errors; $errors = $e->faultstring; echo "Ooop! Error: <b>" . $errors . "</b>"; die; }