Home > Backend Development > PHP Tutorial > When using cURL to obtain remote files in PHP, a redirected url is encountered

When using cURL to obtain remote files in PHP, a redirected url is encountered

巴扎黑
Release: 2016-11-23 13:10:22
Original
946 people have browsed it

I wrote a simple method using cURL in PHP to get a remote file. I encountered a problem during the test:

That is, if you need to jump to get the actual file URL when getting the remote file, then Can't succeed in obtaining.


How to solve it?

See this web during the process of Google: After reading the URL of PHP CURL to get 301 or 302 )Set CURLOPT_FOLLOWLOCATION.

For option CURLOPT_FOLLOWLOCATION, please see:

http://hk.php.net/manual/en/function.curl-setopt.php


In addition, the main point of the above web discussion The problem is that the PHP settings of the local host caused the Curlopt_followLocation to be unavailable. The solution was proposed. The original focus was as follows:

The acquired DEFAULT SAFE and Default Open Basedir are off. The question is processed.


Related labels:
php
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