在WP中使用PHP curl只获取代码而不是完整的Web? [关闭]

I have this simple code:

$theBody = wp_remote_retrieve_body( wp_remote_get('http://www.wordpress.org') );
print_r( $theBody );
die();

It is working, but instead of just echoing the source code it displays the page like as in iframe.

I guess I need to tell my script that I need to show it as a code and not generate the page.

How to do that?

If you want to fetch any source code of a website then you can have a look at PHP Simple HTML DOM Parser this it is very easy to use in this case. Example:

include('parsar.php'); // you will get from that website
$html = file_get_html('http://www.google.com/');
echo $html;