2013-09-28 73 views
0

我想通過HTTP POST方法發佈xml ...代碼工作正常,並顯示所需的消息..「數據收到成功」..問題是,在後端查找它,該數據不會發布在議程Creative後端..我可以在哪裏搞砸了?在此先感謝。使用捲曲後xml

<?php 

function sendXmlOverPost($url, $xml) { 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 

// For xml, change the content-type. 
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); 

curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); 

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // ask for results to be returned 

    // Send to remote and return data to caller. 
$result = curl_exec($ch); 
curl_close($ch); 
return $result; 
} 

$postargs = '<?xml version="1.0" encoding="utf-8"?> 
<Vacancy> 
<Poster>LOGICMELON</Poster> 
<Action>Add</Action> 
<Username>agendacreative</Username> 
<Password>A12!.ndasa55</Password> 
<JobReference>AC Test 1</JobReference> 
<JobTitle>AC Test 1</JobTitle> 
<JobType>F</JobType> 
<JobHours>F</JobHours> 
<Industry>137</Industry> 
<SalaryCurrency>GBP</SalaryCurrency> 
<SalaryFrom>100.0000</SalaryFrom> 
<SalaryTo>200.0000</SalaryTo> 
<SalaryPer>D</SalaryPer> 
<SalaryBenefits>Benefits</SalaryBenefits> 
<Salary>£100 - 200 per day + Benefits</Salary> 
<JobLocation>4</JobLocation> 
<JobCountry>GB</JobCountry> 
<JobDescription>&lt;p&gt;LOGIC MELON TEST VACANCY - PLEASE DO NOT APPLY!!!&lt;/p&gt;&lt;p&gt;Testing the initial integration to Agenda Creative to make sure that the template is compiled properly andt hat the fields are getting sent through correctly.&lt;/p&gt;&lt;p&gt;THIS IS A LOGIC MELON TEST VACANCY - PLEASE DO NOT APPLY FOR THIS ROLE AS IT DOES NOT EXIST!!!&lt;/p&gt;&lt;p&gt;&amp;euro; - Testing Euro Sign&lt;/p&gt;&lt;p&gt;&amp;pound; - Testing Pound Sign&lt;/p&gt;</JobDescription> 
<ContactName>Logic Melon Support</ContactName> 
<ContactEmail>[email protected]</ContactEmail> 
<ApplicationEmail>[email protected]</ApplicationEmail> 
<ApplicationURL></ApplicationURL> 
<WeeksToAdvertise>1</WeeksToAdvertise> 
</Vacancy> 
'; 
    $request = "http://agendacreativerecruitment.co.uk/feed.php"; 
    echo (sendXmlOverPost($request, $postargs)); 
?> 

回答

0

我不知道議程創意。但嘗試這樣的事情?

curl_setopt($ch, CURLOPT_POSTFIELDS, array('xml' => $xml)); 

其中「XML」是後場XML數據應該英寸