Home >Backend Development >PHP Tutorial >curl - How to suppress the output of remote calling addresses in php
I used the curl method in the interface to call a remote address. There is content output in this address. This output affects the output format of my interface. How can I prohibit the output of this remote address? In addition, the output of the remote link is not Should it be the return value after curl_exec execution? Why is it printed directly in the browser?
Reply content:
<code class="php">$url = 'http://postzz173.com'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //返回而不是直接输出 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //re变量里存的才是获取的内容 $re = curl_exec($ch); //要输出就执行 echo ($re);</code>