I already know computers aren’t a great discipline to practice, but I’m waiting on seeing how Saudi Arabia reacts to a few things. Can you explain this?
Source:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://rss.cnn.com/rss/cnn_topstories.rss");
curl_setopt($ch, CURLOPT_HEADER, 0);
$rss = curl_exec($ch);
curl_close($ch);
?>
Then, it is automatically outputting it to the body of an HTML document:
https://yusi.free.nf/services/news.php
Is the documentation incorrect again?
This technology shit is about as weird as it’s programmers.
RSS is XML. And this is what will happen if you output XML in HTML. Everything is working as expected.
6 Likes
Documentation is saying it is suppose to return a string, i.e., populate the variable $rss. Where is it being output to the screen?
Then you didn’t read the documentation, because the docs say it will output it directly:
6 Likes
I thank you. Can you explain the design decision in doing this?
Eh? I’m not a PHP core dev. How I’m I supposed to tell you about that?
3 Likes
I thought you may be able to make more sense of it than I could.
You probably wants to do this as well:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
This tells PHP not to print the results.
7 Likes
system
Closed
June 6, 2025, 12:38am
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.