How to loop request interface in php

步履不停
Release: 2023-02-23 07:08:01
Original
4198 people have browsed it

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;
?>
Copy after login

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)) {
Copy after login

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!

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