Questions tagged [file-get-contents]

In PHP, file_get_contents is the preferred way to read the contents of a file into a string. It will use memory mapping techniques (if supported by your OS) to enhance performance.

In PHP, file_get_contents is used to read an entire file into a single string. Depending on the server configuration, it can also be used to read URLs as well. It differs from file(), in that file is designed to return a resource pointer and then used read the file in chunks (i.e. CSV files). Use file for large files that should not be read all at once. Use file_get_contents to read smaller files and files that cannot be read as easily read in chunks (i.e. JSON)

For more details see the PHP manual entry.

2607 questions
0
votes
1 answer

Generating PDF returns 404

I have a Laravel 5.3 application (that uses URL rewriting) that runs on nginx 1.12.1 on an Ubuntu server. I want to create PDF report, and I find this mPDF wrapper for Laravel. My page works from the browser but throw 404 error when mPDF tries to…
Krapow
  • 611
  • 6
  • 26
0
votes
0 answers

Get Values Line By Line in File_GET_CONTENT

Let Suuppoe i am getting Text from another site is as follow EXCHANGE…
user9341437
0
votes
1 answer

PHP redirect to another page after successful get data from file_get_contents()

I have a pop up payment gateway which I have a public push back url to know the success data from the bank. mysite.com/push_back // push back url gave to bank in order to send back data function push_back() { $content =…
jebas jay
  • 1
  • 2
0
votes
1 answer

Neither the_content() or have_post is showing content (posts) on my site

Here is a link to my page: http://list.thorsteinnhelgason.is/index.php/blog/ This is my code:
0
votes
0 answers

PHP Parse certain Element HTML File

how can I parse certain Elements from a HTML File via PHP Thats my HTML File: https://pastebin.com/raw/vVYqrCUd I want to get the , and the from every item in the HTML File. Thats my current PHP Code: $json_object=…
Maro
  • 55
  • 1
  • 7
0
votes
1 answer

PHP file_get_contents(file.php); execute PHP code in file

I'm currently having an issue, where I have some php code in a file and calling that file from another file. so: index.php is calling file.php and file.php has some php code in it. The reason I'm using file_get_contents, is that I have code in…
Keoki
  • 184
  • 4
  • 20
0
votes
1 answer

PHP file_get_contents only works for some servers

I am working on a website, that will have a large number of files. So, I made a separate server for my files such as images and txt files. The problem is that php's file_get_contents function does not work for this server. I have tried echo…
Pete
  • 333
  • 1
  • 12
0
votes
1 answer

Searching for file in directory using glob, not returning results

I'm trying to make a small script for retrieving configuration files containing mapping instructions for a product import, using php glob. But I fail miserably. What I have right now: echo "Shop type: " . $this->shopType . '
'; echo "Shop…
qvotaxon
  • 370
  • 5
  • 16
0
votes
0 answers

504 when using PHP file_get_contents on Amazon EC2

I have an odd issue We are in the midst of moving our site from on-premise servers (PHP 5.3) to Amazon EC2 cloud (PHP 7.0), both running apache I have a php function that calls file_get_contents, which i then decode json for into a variable to do…
Jay Rizzi
  • 4,196
  • 5
  • 42
  • 71
0
votes
2 answers

PHP post is appending extra " \" " Why is it so?

I am using and i am posting this text area to a php file $file = $_POST["content"]; echo $file; The output that i…
Yahoo
  • 4,093
  • 17
  • 59
  • 85
0
votes
1 answer

WAMP64 ssl for file_get_contents

I have a php file that i want to pars something from wiki. The code is: file_get_contents("https://en.wikipedia.org/w/api.php?format=json&action=parse"); I constantly get the error: file_get_contents(): Unable to find the wrapper "https" - did…
Gregor Meier
  • 35
  • 1
  • 7
0
votes
1 answer

file_get_contents($file) throws a warning while executing the loop in 2nd iteration in PHP

I have a number of json-format .txt files. I am trying to get each file one by one, modify it's contents and then put those contents back to the file. For this purpose I have executed a loop that does this process for every file. The loop runs…
Mubeen Ul Haq
  • 33
  • 1
  • 9
0
votes
3 answers

php using file_get_contents with an array

I am trying to pull values from the following url: https://api.binance.com/api/v1/ticker/allPrices What I want to accomplish: Obtain all the "symbol" values printed in the website (one under the other) The result I am looking for, would…
F0l0w
  • 243
  • 5
  • 15
0
votes
3 answers

PHP statement within echo

I am essentially trying to combine to PHP statements. I want to achieve something like this:
stevland
  • 119
  • 1
  • 8
0
votes
0 answers

PHP Simple HTML DOM with POST method?

How to use Simple HTML DOM with input POST method? I try to do with cUrl: $ch = curl_init(); $timeout=5; $data = array('teks' => '4ia17'); $data=http_build_query($data); curl_setopt($ch,CURLOPT_URL,"http://baak.gunadarma.ac.id/jadwal/cariJadKul");…
1 2 3
99
100