我正在开发一个需要系统包管理器的脚本.我已经使用该os.uname()功能识别了Fedora,Gentoo和Arch Linux .
但是,(打开)SUSE uname结果与其他Linux Distros相同.我uname在维基百科上发现了许多发行版的结果.
有没有什么聪明的方法可以用Python识别(打开)SUSE?
我收到以下错误:
警告: file_get_contents( https://www.readability.com/api/content/v1/parser?url=http://www.redmondpie.com/ps1-and-ps2-games-will-be-playable-on- playstation-4-very-soon/?utm_source=dlvr.it&utm_medium=twitter&token=MYAPIKEY) [function.file-get-contents]:无法打开流:HTTP 请求失败!HTTP/1.1 404 NOT FOUND in /home/DIR/htdocs/readability.php 第 23 行
通过一些 Echoes,我得到了函数解析的 URL,它很好且有效,我从浏览器发出请求,一切正常。
问题是我用 file_get_contents 得到了上述错误,我真的不明白为什么。
URL 有效并且该功能未被免费托管服务阻止(所以我不需要 Curl)。
如果有人能发现我的代码中的错误,我将不胜感激!谢谢...
这是我的代码:
<?php
class jsonRes{
public $url;
public $author;
public $url;
public $image;
public $excerpt;
}
function getReadable($url){
$api_key='MYAPIKEY';
if(isset($url) && !empty($url)){
// I tried changing to http, no 'www' etc... -THE URL IS VALID/The browser opens it normally-
$requesturl='https://www.readability.com/api/content/v1/parser?url=' . urlencode($url) . '&token=' . $api_key;
$response = file_get_contents($requesturl); // * here the …Run Code Online (Sandbox Code Playgroud)