Tôi chỉ sử dụng một file_get_contents()
để có được những tweet mới nhất từ một người sử dụng như thế này:file_get_contents ném 400 Bad Request lỗi PHP
$tweet = json_decode(file_get_contents('http://api.twitter.com/1/statuses/user_timeline/User.json'));
này hoạt động tốt trên localhost của tôi, nhưng khi tôi tải nó lên máy chủ của tôi nó ném lỗi này:
Warning: file_get_contents(http://api.twitter.com/1/statuses/user_timeline/User.json) [function.file-get-contents]:failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request...
Không chắc chắn điều gì có thể gây ra, có thể cấu hình php tôi cần đặt trên máy chủ của mình?
Cảm ơn trước!
đọc: http://stackoverflow.com/questions/697472/file-get-contents-returning-failed-to-open-stream-http-request-failed –
Vui lòng xem [đống này câu hỏi] [1] vì nó có thể sẽ trả lời câu hỏi của bạn. [1]: http://stackoverflow.com/questions/3710147/php-get-content-of-http-400-response –
Cảm ơn Peter Brooks! Điều đó đã hiệu quả! – javiervd