Home > Backend Development > PHP Tutorial > curl - How to suppress the output of remote calling addresses in php

curl - How to suppress the output of remote calling addresses in php

WBOY
Release: 2016-08-04 09:19:51
Original
1914 people have browsed it

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:

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?

<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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template