我有一个小问题。当我通过file_get_contents获取页面时,未知符号被连接到输出,这会破坏XML结构。
我该如何解决这个问题?
码:
file_get_contents('https://emea2cps.adobeconnect.com/api/xml?action=login&login=EMAIL&password=PASSWORD');
$cookies = array();
foreach ($http_response_header as $hdr) {
if (preg_match('/^Set-Cookie:\s*([^;]+)/', $hdr, $matches)) {
parse_str($matches[1], $tmp);
$cookies += $tmp;
}
}
//print_r($cookies);
//echo "//////////////////";
$cook=$cookies['BREEZESESSION'];
echo $cook;
$opts = array(
'http'=>array(
'method'=>'GET',
'header'=>'Cookie: BREEZESESSION='.$cook.'\r\n',
)
);
$context = stream_context_create($opts);
echo "////////////////////////";
// Open the file using the HTTP headers set above
//$file = file_get_contents('http://www.example.com/', false, $context);
$file1 = file_get_contents('https://meet77842937.adobeconnect.com/api/xml?action=report-my-meetings', false, $context);
print_r($file1);
$xml = new SimpleXMLElement($file1);
输出:
em2breezgwbhxopvpvknsux7////////////////////////sample1aksamaimeet77842937.adobeconnect.com/sample1/2014-02-28T06:15:00.000-08:002014-02-28T07:15:00.000-08:00true01:00:00.000sample2meet77842937.adobeconnect.com/sample2/2014-02-28T06:15:00.000-08:002014-02-28T07:15:00.000-08:00true01:00:00.000lastTtmeet77842937.adobeconnect.com/lastone/2014-02-28T15:30:00.000-08:002014-02-28T18:00:00.000-08:00false02:30:00.000�
查看最后一个符号。它绝对不能存在。
关于