Sponsored Content
Top Forums Shell Programming and Scripting PHP embedding functions inside strings? Post 302693855 by stevensw on Wednesday 29th of August 2012 10:19:25 PM
Old 08-29-2012
What if you're reading in a large file using file_get_contents() and you want the variables in that file to be evaluated? This file would not contain PHP code.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Embedding Perl construct in ksh...

Hi, I have an embedded Perl construct in a korn script. However, I cannot seem to access the shell variables that were declared outside this Perl section. This is how my script is written....I have also tried back-ticks where I assign the shell variable to my local perl variable, still... (1 Reply)
Discussion started by: svetlur
1 Replies

2. Programming

Embedding xnest in C code

I hope I am posting this in the right section. I have c file that is using the motif GUI toolkit to draw widgets and things of that sort. I also have another program that runs with xnest. I need to figure out a way to place that xnest program in my c code so that it exists in the window that the... (4 Replies)
Discussion started by: lesnaubr
4 Replies

3. Shell Programming and Scripting

Embedding a command with SSH

Hi I am trying to run a script centrally that will go out and set the network management ip address on all my Sun boxes running Solaris. We have decided that the network management address will be the boxes main IP address but the first octet as a 172 rather than a 10, so for example ifconfig -a... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

4. Shell Programming and Scripting

CSH: Concatenating Strings, how to add new line character and functions?

Hello, I'm trying to run a program on a directory (traverse sub dirs too) through my csh script. Arrays support in CSH is appalling, something like associative arrays would have helped me do this so much easier. Anyway, I want to hold some details extracted from the program and then at the... (0 Replies)
Discussion started by: ragabonds
0 Replies

5. UNIX Desktop Questions & Answers

Embedding file output into a script

Hello. I found a Unix script on this site that calculates a date that is 2 months earlier from today. I'm using that script and writing the value to a file called 2monthsago.txt. I want to use that value in another script. Below is my attempt at doing that and the results. My Script: ... (1 Reply)
Discussion started by: Colel2
1 Replies

6. Shell Programming and Scripting

Embedding HTML in Perl script

My webpage is hosted from perlscript(homepage.pl), i want to add piece of html code in the footer of the homepage. I simply pasted the html code at the end of the perl script as below... ======================================================== close(OUTSQL); ... (4 Replies)
Discussion started by: paventhan
4 Replies

7. Shell Programming and Scripting

Difficulty embedding variable within AWK

Hi, I am working on a parsing script but cannot figure out how to accomplish this. Here is a simplified version of the script: #!/bin/bash DS=$1 DS=`expr $DS \* 2` DS=`expr $DS + 7` cat $FILENAME | awk '/<row><v> +/' | awk '{printf("%.0f %.0f\n", $6, $9)}' The problem is that I want the... (2 Replies)
Discussion started by: Nisrak
2 Replies

8. UNIX for Advanced & Expert Users

Embedding code into ssh keys

Hi Its been a long time since I worked with ssh keys containing embedded shell commands and cannot remember how it is done. Does anyone know of any sites that have a good tutorial on the subject? I'm not having much luck searching Google for it. Incidentally, searching this forum for the... (6 Replies)
Discussion started by: steadyonabix
6 Replies

9. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies
STREAM_GET_CONTENTS(3)							 1						    STREAM_GET_CONTENTS(3)

stream_get_contents - Reads remainder of a stream into a string

SYNOPSIS
string stream_get_contents (resource $handle, [int $maxlength = -1], [int $offset = -1]) DESCRIPTION
Identical to file_get_contents(3), except that stream_get_contents(3) operates on an already open stream resource and returns the remain- ing contents in a string, up to $maxlength bytes and starting at the specified $offset. PARAMETERS
o $handle ( resource) - A stream resource (e.g. returned from fopen(3)) o $maxlength ( integer) - The maximum bytes to read. Defaults to -1 (read all the remaining buffer). o $offset ( integer) - Seek to the specified offset before reading. If this number is negative, no seeking will occur and reading will start from the current position. RETURN VALUES
Returns a string or FALSE on failure. CHANGELOG
+--------+-------------------------+ |Version | | | | | | | Description | | | | +--------+-------------------------+ | 5.1.0 | | | | | | | The $offset was added. | | | | +--------+-------------------------+ EXAMPLES
Example #1 stream_get_contents(3) example <?php if ($stream = fopen('http://www.example.com', 'r')) { // print all the page starting at the offset 10 echo stream_get_contents($stream, -1, 10); fclose($stream); } if ($stream = fopen('http://www.example.net', 'r')) { // print the first 5 bytes echo stream_get_contents($stream, 5); fclose($stream); } ?> NOTES
Note This function is binary-safe. SEE ALSO
fgets(3), fread(3), fpassthru(3). PHP Documentation Group STREAM_GET_CONTENTS(3)
All times are GMT -4. The time now is 11:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy