공용 API에서 XML을 가져와야하지만 내 앱이 Flash에 있고 공용 서비스가 crossdomain.xml 파일을 구현하지 않습니다. 이 URL을 요청하는 프록시에 대해이 PHP 스크립트 온라인 (아래)을 발견했습니다. 이 같은 URL에 대해 잘 작동 :XML 가져 오기위한 PHP 프록시 : URL 인수 문제
http://mysite.com/xml_proxy.php?url=http://rss.cnn.com/rss/cnn_topstories.rss
하지만 스크립트에 중 스트립 것 또는 같은 URL에 인수 무시 :
http://mysite.com/xml_proxy.php?url=http://publicapiserver.com?app_ID=35235x&app_key=84x
내가 무지 PHP 해요입니다. 이 스크립트가이 URL 인수를 처리하도록하는 쉬운 방법이 있습니까? 매우 감사합니다.
<?php
$post_data = $HTTP_RAW_POST_DATA;
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($post_data);
$ch = curl_init($_GET['url']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
if (strlen($post_data)>0){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
$response = curl_exec($ch);
$response_headers = curl_getinfo($ch);
if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
header('Content-type: ' . $response_headers['content-type']);
print $response;
}
?>
아 남자가 총 말이 ... : 당신은 프록시 비누 클라이언트를 필요로하는 경우 – Gregir