Sto cercando di utilizzare file_get_contents()
per afferrare un feed Twitter, ma sto ottenendo il seguente avviso:file_get_contents() non è riuscito ad aprire flusso:
failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
Il mio codice:
$feed = 'http://twitter.com/statuses/user_timeline.rss?screen_name=google&count=6';
$tweets = file_get_contents($feed);
Sto usando Google solo per motivi di test. allow_url_fopen
è abilitato nel mio file php.ini
.
Qualche idea di cosa potrebbe essere sbagliato?
E 'anche molto più facile da mettere a punto, dal momento che si può ottenere per scaricare la richiesta e le intestazioni si invia (le richieste malformate essendo la causa usuale di HTTP 400 errori) –
http://stackoverflow.com/questions/ 555523/file-get-contents-vs-curl-what-has-better-performance –
Sì, circa 4-5 volte più veloce. –