-4

I have coded like this

$xml=http_get('https://vnexpress.net/rss/khoa-học.rss');

but it has error

Fatal error: Uncaught Error: Call to undefined function http_get() in C:\Apache24\htdocs\abc.php:22 Stack trace: #0 {main} thrown in C:\Apache24\htdocs\abc.php on line 22

I also coded

$doc=DOMDocument::load('https://vnexpress.net/rss/khoa-hoc.rss');

errors

Warning: DOMDocument::load(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:\Apache24\htdocs\abc.php on line 17

Warning: DOMDocument::load(): I/O warning : failed to load external entity "https://vnexpress.net/rss/khoa-hoc.rss" in C:\Apache24\htdocs\abc.php on line 17

Thanks for reading.

StephenKhoa
  • 105
  • 8

1 Answers1

0

You can use the " file_get_contents" method like this :

$test = file_get_contents('https://vnexpress.net/rss/khoa-hoc.rss');
echo $test;
Léo R.
  • 2,620
  • 1
  • 10
  • 22
  • It appeared the warnings Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:\Apache24\htdocs\abc.php on line 23 Warning: file_get_contents(https://vnexpress.net/rss/khoa-hoc.rss): failed to open stream: No such file or directory in C:\Apache24\htdocs\abc.php on line 23 – StephenKhoa Feb 12 '18 at 13:38
  • The problem is solved when I uncommented out the line ";extension=openssl" in php.ini – StephenKhoa Feb 12 '18 at 14:01