1

SOAP と xml を使用してマーチャントにリードを送信する PHP スクリプトを作成しようとしていますが、次のエラーが発生します。

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from ' https://tst.webservices.outsurance.co.za/SecureHost/Lead/LeadPostService.svc?wsdl ' : failed to外部エンティティを読み込む " https://tst.webservices.outsurance.co.za/SecureHost/Lead/LeadPostService.svc?wsdl "

セキュア Web サービスに接続できないようです。彼らは証明書を含める必要があると言ったので含めましたが、それでも同じエラーが発生します。私はいくつかの解決策を検索しましたが、それらのほとんどはopenssl、fopenなどを有効にすることを提案していますが、それらはすべてサーバーで既に有効になっています。これが私のコードです:

function sendRequest($url, $params)
{
    $request = curl_init($url); // initiate curl object
    curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
    curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
    curl_setopt($request, CURLOPT_POSTFIELDS, $params); // use HTTP POST to send form data
    curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.
    $response = curl_exec($request); // execute curl post and store results in $post_response
    curl_close ($request); // close curl object
    return $response;
}


// Get Variables sent from websites
$uname = $_GET['un'];
$usname = $_GET['ul'];
$uphone = $_GET['up'];
$uemail = $_GET['ue'];
$testlive = $_GET['test'];
$aff_id = $_GET['af'];
$unique_id = $_GET['uid'];
$script = $_GET['script'];

// Convert URL and Name split
$rurl = 'http://'.$_GET['rurl'];

// Split Name if no surname entered
if (strlen($usname) > 0) {
    $firstname = $uname;
    $lastname = $usname; // I have a first and lastname
} else {
    list($firstname, $lastname) = explode(" ",$uname,2); // I only entered my firstname
}
// Determine phone number format
$phoneformat = strpos($uphone,'-');
if($phoneformat === false) {
 // string - NOT found in haystack
 $phonesubmit = $uphone; 
} else {
    $phone1 = substr($uphone,0,3);
    $phone2 = substr($uphone,4,3);
    $phone3 = substr($uphone,8,4);
    $phonesubmit = $phone1.$phone2.$phone3;
}
// Determine Live or Test
$testlive = strtolower($testlive);
switch ($testlive) {
    case "test":
        $debug = true; //Set this to 'false' to redirect users
        $outurl = 'https://tst.webservices.outsurance.co.za/SecureHost/Lead/LeadPostService.svc?wsdl'; // Set to TEST environment
        break;
    case "live":
        $debug = false;
        $outurl = 'https://webservices.outsurance.co.za/SecureHost/Lead/LeadPostService.svc?wsdl'; // Set to LIVE environment
        break;
}

// Set Variables
if($debug) echo("<pre>\n");
if($debug) echo("Form data complete\n");
if($debug) echo("Creating XML document\n");

$cert = "certificate.cer";
$client = new SoapClient($outurl, array('local_cert'=>file_get_contents($cert)));

$xml = new stdClass();
$xml->mode = 'LIVE';
$xml->title = '';
$xml->firstname = $firstname;
$xml->lastname = $lastname;
$xml->id = $unique_id;
$xml->homecode = '';
$xml->hometel = '';
$xml->workcode = '';
$xml->worktel = '';
$xml->mobile = $phonesubmit;
$xml->homecode = '';
$xml->email = $uemail;
$xml->comment = $script;
$xml->source = 'UPSTART';
$xml->notes = '';
$xml->language = 'E';
$xml->product = 'P';

$result = $client->SubmitAffiliateLead($xml);
print_r($result);
4

0 に答える 0