0
Привет Я пытаюсь отправить мыло запрос на powerpay.biz и я не получаю ответа, плюс, когда я использую мой тестовый URLPHP CURL мыло запрос Печать Ответ
https://gkicmerchants.com/admin/classes/soap-request.xml
я получаю эту ошибку
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found in /home/content/g/k/i/gkic1848/html/admin/classes/submit_applicant.class.php on line 299
Вот мой код:
$username = 'user';
$password = 'password';
$credentials = $username.":".$password;
$url = "http://gkicmerchants.com/admin/classes/soap-server.php";
$soap_request = '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
....
</soap:Body>
</soap:Envelope>';
$header = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: '".$url."'",
"Content-length: ".strlen($soap_request),
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC) ;
curl_setopt($curl, CURLOPT_USERPWD, $credentials);
curl_setopt($curl, CURLOPT_SSLVERSION,3);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $soap_request);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($curl, CURLOPT_URL, $url);
// perform the request
$xml_result = curl_exec($curl);
// check for errors
if ($xml_result === false) {
$error_occurred = true;
}
else {
$xml = new SimpleXMLElement($xml_result);
print_r($xml);
}
Что-то не так с параметрами curl_setopt?
сообщение об ошибке означает, что ответ вы получаете не отформатирован - вы пробовали вторя из '$ xml_result', чтобы увидеть, что вы на самом деле получить обратно? – andrewsi
вот мой результат https://gkicmerchants.com/admin/classes/soap-request.xml – Hector
, когда я эхо получаю: HTTP/1.1 100 Продолжить HTTP/1.1 200 OK Дата: Чт, 18 апр 2013 17: 06:27 GMT Сервер: Apache Content-Length: 0 Content-Type: text/html – Hector