Home >Backend Development >PHP Problem >How to loop request interface in php

How to loop request interface in php

步履不停
步履不停Original
2019-06-11 14:35:044239browse

How to loop request interface in php

Method 1:

Use file_get_contents to get the content in get mode

[php] view plaincopyprint?
<?php
$url=&#39;http://www.domain.com/&#39;;
$html = file_get_contents($url);
echo $html;
?>

Method 2:

Use fopen to open the url and get the content by get method

[php] view plaincopyprint?
<?php
$fp = fopen($url, &#39;r&#39;);
//返回请求流信息(数组:请求状态,阻塞,返回值是否为空,返回值http头等)
[php] view plaincopyprint?
stream_get_meta_data($fp);
[php] view plaincopyprint?
while(!feof($fp)) {

Recommended tutorial:

PHP development APP interface video tutorial

The above is the detailed content of How to loop request interface in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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