Questions tagged [php-stream-wrappers]

PHP provides a number of miscellaneous I/O streams that allow access to PHP's own input and output streams, the standard input, output and error file descriptors, in-memory and disk-backed temporary file streams, and filters that can manipulate other file resources as they are read from and written to.

PHP provides a number of miscellaneous I/O streams that allow access to PHP's own input and output streams, the standard input, output and error file descriptors, in-memory and disk-backed temporary file streams, and filters that can manipulate other file resources as they are read from and written to.

Some of the supported streams are:

  • php://stdin,
  • php://stdout
  • php://stderr
  • php://input
  • php://output
  • php://fd
  • php://memory
  • php://temp
  • php://filter
48 questions
0
votes
2 answers

Encrypting native PHP streams

I'm investigating the possibility of symmetrically encrypting native streams in PHP. I've found lots of information showing how to perform this sort of encryption on normal strings (entirely in memory) using modern and recommended libraries such as…
Emmet O'Grady
  • 269
  • 2
  • 8
0
votes
1 answer

Difference between using "file://" stream wrapper or put directly file path (PHP)

I read on another topic that file('file:///path/to/file.txt'); file('/path/to/file.txt'); are equivalent. So, what's the point to use file:// stream wrapper? Are there some cases where there are some differences?
0
votes
1 answer

PHP; get post string from external url (JAVA)

I need to send string data to an external url which is an API for clients, but I always get the server sending back an error, and then I checked the log in the server which is written in JAVA, it throws an…
muchHassle
  • 21
  • 3
0
votes
1 answer

Http request to php stream image

I have a php file, when you open it, a picture is going to be downloaded and opened. Here is my code: header('Content-type: image/jpeg'); $stream = fopen('php://output', 'w'); // Stream to browser like with…
Vahid Najafi
  • 4,654
  • 11
  • 43
  • 88
0
votes
1 answer

Provide a file handle to a PHP function expecting a file path

Using PHPExcel, I would like to read a file from the internet. The PHPExcel library seems suited to opening only local files, not URLs. Here's what I tried:
Martin Burch
  • 2,726
  • 4
  • 31
  • 59
0
votes
1 answer

Read from live data feed php

I am using something called DAP (https://github.com/rapid7/dap) which helps deal with large file handling and outputs an ever growing list of data. For example: curl -s https://scans.io/data/rapid7/sonar.http/20141209-http.gz | zcat | head -n 10 |…
Antony
  • 3,875
  • 30
  • 32
0
votes
1 answer

Pass stream wrapped by Zend Diactoros PhpInputStream (PSR-7 StreamInterface) to fopen-like function?

I have to write something to process an XML document sent via POST. The document has base-64 encoded binaries inside so the request can be quite large. This works: $document = simplexml_load_file('php://input'); But I am using the Zend Diactoros…
Pocketsand
  • 1,261
  • 10
  • 15
0
votes
1 answer

PHP: Writing to a CSV file while stream headers are in a function

I'm attempting to write an SQL query to a CSV file in PHP. I have had this this working, thanks to some advice [in a previous question][1]. However I'm attempting to reduce repetition in my code were possible from the previous example. I'm creating…
Liam Fell
  • 1,308
  • 3
  • 21
  • 39
0
votes
1 answer

Missing last character while base64 encoding a file from S3 using stream filter

I have a very weird issue with PHP's stream conversion filter (base64_encode). My goal is to read file from s3 bucket using AWS S3 SDK's streamWrapper and base64 encode it, echo it to response. For this I am using following…
0
votes
1 answer

PHPExcel wrongly reading xls file as HTML

I am using PHPExcel to read a large "xls" file. Firstly, I am determining the file type for reader using PHPExcel_IOFactory::identify($inputFileName). However, PHPExcel is wrongly identifying it as HTML file and using HTML Reader which fails with…
AJINKYA
  • 741
  • 2
  • 9
  • 20
0
votes
1 answer

How can I get and manage a stream resource of DB? PHP-DB2

I am manage CLOB and BLOB types with DB2, PHP and Yii Framework (although I am using only php). I am getting to upload files to DB2. With CLOB and BLOB types. But I have a problem, I don't get to download files. I obtain a resource, stream type with…
vicenrele
  • 971
  • 3
  • 19
  • 37
0
votes
2 answers

PHP fread catch stream timeout happened

I use the PHP function fread to read the data from a stream opened with $fh=fopen('http://.....'); i set the timeout for the stream with socket_set_timeout($fh,10); if a timeout happened during the fread execution then can i somehow to know…
Roman Gelembjuk
  • 1,797
  • 2
  • 25
  • 50
0
votes
0 answers

send video stream byte-byte to the clients

I have one question. Imagine, that video files are in the server named A. using php script (which is in the server named "B") we can get stream of the video (from the server "A" to the server "B"). The important thing is that only B server cant get…
grep
  • 5,465
  • 12
  • 60
  • 112
0
votes
0 answers

stream wrapper and writing to php://memory results in internal server error 500

I'm trying to write a custom wrapper in PHP using the Stream Wrapper class. What I have now is pretty much simple and straight forward. class Stream { public $resource; public static function wrap() { …
Vivendi
  • 20,047
  • 25
  • 121
  • 196
0
votes
1 answer

Unable to find what kind of CURL Post Request

I've recieved the following data which I need to post to server and I cant find out how exactly I need to do it in PHP. I need to send numbers, but I cant see any parameter thier asking me to send it from. any ideas how I could send this data?
D_R
  • 4,894
  • 4
  • 45
  • 62