Home php教程 php手册 file_get_contents不能获取带端口的网址

file_get_contents不能获取带端口的网址

Jun 13, 2016 am 09:57 AM
file get cannot introduce classmate bring article of port URL Obtain

本文章来给各位同学介绍file_get_contents不能获取带端口的网址解决办法,有需要了解的同学可参考。


先们来了解file_get_contents() 函数,官方介绍说它是把整个文件读入一个字符串中。


例子

echo file_get_contents("test.txt");
?>

输出:

This is a test file with test text.

同样此函数还可以用于获取远程服务器上的内容


file_get_contents('http://www.bKjia.c0m');

这样也是没有问题,但是如果我带了端口了就有问题了


例如:


file_get_contents('http://localhost:12345');


没有任何获取。

解决方法是 :关闭selinux

1 永久方法 – 需要重启服务器

修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启服务器。

2 临时方法 – 设置系统参数

使用命令setenforce 0

附:

setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式

php的allow_url_fopen选项是关闭了

原因是我们php.ini中把php的allow_url_fopen选项是关闭了,我们只要把它打开即可。

如果你没有权限打开allow_url_fopen的话我们可使用curl函数的来替换,也是很方法的。

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to enter the URL in steam? How to open a website on steam How to enter the URL in steam? How to open a website on steam Mar 14, 2024 pm 12:10 PM

If you want to check some relevant information in Steam or share some website links with friends, how do you do it? Can I enter a URL into steam? Of course it is possible. Below I will teach you how to open a URL in Steam. Specific methods: 1. First, we open steam. 2. Click the Settings option. 3. Then switch to the interface tab. 4. Check Show address bar. 5. Then enter the URL in the address bar to use the browser.

Soundbar detected as monitor screen on Windows PC [Fix] Soundbar detected as monitor screen on Windows PC [Fix] Feb 19, 2024 pm 11:42 PM

On Windows PCs, some users have discovered that the Soundbar is recognized as a monitor when connected to the HDMI port. This may cause some confusion, but the solution is not the only one. How to Connect a Soundbar to a PC via HDMI Most soundbars use HDMI, optical, or 3.5mm audio connections. If your soundbar only supports HDMI connections, it must be connected to an HDMI port labeled HDMIARC. Many TVs or monitors are usually equipped with multiple HDMI ports, one of which should support the ARC protocol that complies with the HDMI standard. In other words, HDMI is an interface used to transmit audio and video. If the device does not have an HDMI port, consider using a monitor.

How can I make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! How can I make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! Mar 15, 2024 pm 04:13 PM

1. How can you make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! 1. Activate basic rights and interests: original articles can earn profits by advertising, and videos must be original in horizontal screen mode to earn profits. 2. Activate the rights of 100 fans: if the number of fans reaches 100 fans or above, you can get profits from micro headlines, original Q&A creation and Q&A. 3. Insist on original works: Original works include articles, micro headlines, questions, etc., and are required to be more than 300 words. Please note that if illegally plagiarized works are published as original works, credit points will be deducted, and even any profits will be deducted. 4. Verticality: When writing articles in professional fields, you cannot write articles across fields at will. You will not get appropriate recommendations, you will not be able to achieve the professionalism and refinement of your work, and it will be difficult to attract fans and readers. 5. Activity: high activity,

Hongmeng native application random poetry Hongmeng native application random poetry Feb 19, 2024 pm 01:36 PM

To learn more about open source, please visit: 51CTO Hongmeng Developer Community https://ost.51cto.com Running environment DAYU200:4.0.10.16SDK: 4.0.10.15IDE: 4.0.600 1. To create an application, click File- >newFile->CreateProgect. Select template: [OpenHarmony] EmptyAbility: Fill in the project name, shici, application package name com.nut.shici, and application storage location XXX (no Chinese, special characters, or spaces). CompileSDK10, Model: Stage. Device

Where to get Google security code Where to get Google security code Mar 30, 2024 am 11:11 AM

Google Authenticator is a tool used to protect the security of user accounts, and its key is important information used to generate dynamic verification codes. If you forget the key of Google Authenticator and can only verify it through the security code, then the editor of this website will bring you a detailed introduction on where to get the Google security code. I hope it can help you. If you want to know more Users please continue reading below! First open the phone settings and enter the settings page. Scroll down the page and find Google. Go to the Google page and click on Google Account. Enter the account page and click View under the verification code. Enter your password or use your fingerprint to verify your identity. Obtain a Google security code and use the security code to verify your Google identity.

How to automate tasks using PowerShell How to automate tasks using PowerShell Feb 20, 2024 pm 01:51 PM

If you are an IT administrator or technology expert, you must be aware of the importance of automation. Especially for Windows users, Microsoft PowerShell is one of the best automation tools. Microsoft offers a variety of tools for your automation needs, without the need to install third-party applications. This guide will detail how to leverage PowerShell to automate tasks. What is a PowerShell script? If you have experience using PowerShell, you may have used commands to configure your operating system. A script is a collection of these commands in a .ps1 file. .ps1 files contain scripts executed by PowerShell, such as basic Get-Help

Fix AHCI Port 0 Device Error on Windows Computer Fix AHCI Port 0 Device Error on Windows Computer Feb 19, 2024 pm 12:45 PM

If you encounter an AHCI port 0 device error every time you start your computer, you need to follow the methods provided in this article to solve the problem. What is AHCI port 0 device error? AHCI device errors are reported by the BIOS. SMART has indicated that the hard drive on port 0 is faulty and may not be accessible. The hard drive may have problems at any time. If it is a desktop computer, it is recommended to try changing the hard drive connection port. If the problem persists, it may be a problem with the hard drive itself. You can run a disk check tool, disable the failed hard drive and check the ports to resolve this issue. Fixing AHCI Port 0 Device Errors on Windows Computers Typically, AHCI Port0 device errors do not originate from operating system issues, but rather from the hard drive failing on port 0.

How to use LSOF to monitor ports in real time How to use LSOF to monitor ports in real time Mar 20, 2024 pm 02:07 PM

LSOF (ListOpenFiles) is a command line tool mainly used to monitor system resources similar to Linux/Unix operating systems. Through the LSOF command, users can get detailed information about the active files in the system and the processes that are accessing these files. LSOF can help users identify the processes currently occupying file resources, thereby better managing system resources and troubleshooting possible problems. LSOF is powerful and flexible, and can help system administrators quickly locate file-related problems, such as file leaks, unclosed file descriptors, etc. Via LSOF Command The LSOF command line tool allows system administrators and developers to: Determine which processes are currently using a specific file or port, in the event of a port conflict

See all articles