/*
我有一个问题,要求从php教程代码的url。我需要调用一个服务,使用从我的php代码的查询字符串。如果我的浏览器中键入一个网址,它工作还算可以,但如果我使用文件获取,内容()来拨打电话,我得到:
代码如下 | 复制代码 |
$query=file_get_contents('http://www.111cn.net'); echo($query); |
可能出现问题有三种
一、php.ini 的allow_url_fopen选项是不是开着的?如果是off就不能访问了,把它变成on.
二、php.ini开启了安全模式
三、机器装了防火强
其它解决方法
*/
代码如下 | 复制代码 |
$curl_handle=curl_init(); curl_setopt($curl_handle, curlopt_url,'http://www.111cn.net'); curl_setopt($curl_handle, curlopt_connecttimeout, 2); curl_setopt($curl_handle, curlopt_returntransfer, 1); curl_setopt($curl_handle, curlopt_useragent, 'your application name'); $query = curl_exec($curl_handle); curl_close($curl_handle); |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function