【发布时间】:2014-11-07 09:49:31
【问题描述】:
我正在尝试从 Readability 获得一个简单的 JSON 回复,使用 Readability 的 API 的直接链接可以正常工作,例如:
$http.jsonp('https://www.readability.com/api/content/v1/parser?url='+url+'&token='+token+'&callback=JSON_CALLBACK').success(function(data) { ... etc
但在使用我自己的“代理”时不起作用:
<?php
header('Content-Type: application/json');
print file_get_contents('https://www.readability.com/api/content/v1/parser?url='.urlencode($_GET['url']).'&token='.$token.'&callback=JSON_CALLBACK');
?>
与:
$http.jsonp('parser.php?url='+url).success(function(data) { ...
我也尝试过 curl 并复制所有标题等。我不明白,为什么 http.jsonp 无法从我自己的代理中找到变量 JSON_CALLBACK?
【问题讨论】:
标签: javascript php json angularjs proxy