I'm trying to get a simple JSON reply from Readability, which works ok using the direct link to Readability's API, eg:
$http.jsonp('https://www.readability.com/api/content/v1/parser?url='+url+'&token='+token+'&callback=JSON_CALLBACK').success(function(data) { ... etc
But doesn't work when using my own "proxy":
<?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');
?>
with:
$http.jsonp('parser.php?url='+url).success(function(data) { ...
I've also tried it with curl and duplicating all of the headers, etc. I don't get it, how come http.jsonp can't find the variable JSON_CALLBACK from my own proxy?
JSON_CALLBACK
被调用时更换angular.callbackSomething
和你的PHP使用硬编码JSON_CALLBACK
所以当角度尝试运行callbackSomething
没有从JSONP功能用这种方法,希望是有道理
print file_get_contents('https://www.readability.com/api/content/v1/parser?url='.urlencode($_GET['url']).'&token='.$token.'&callback='.$_GET['callback']);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.