Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Including External Php File And Executing A Command


I have two different servers, and i need to call a php of server B from server A, so i did this:

SERVER A:

index.php has:
include('http://server-b/file.php');

The content of file.php is:
phpinfo();

... but phpinfo() throws info about server B instead of its parent file SERVER A.




View Complete Forum Thread with Replies

Related Forum Messages:
Including External File
I have two sites that I am trying to get to "talk" to each other.

I have one site that contains a PHP file that basically outputs an XML formatted list depending on the file structure in that directory.

The other site needs this XML formatted data to complete the PHP generated XML file that I am trying to put together. (Much like syndicating my content from one site to another)

I have tried using readfile, include and header(Location:) and none of them seem to be working. What I need is for the calling file to somehow include the output of the remote file. (The same stuff you see if you view the source) What happens is that I can 'readfile' my index page on that site, but not the one that puts out the XML data that I need. Could it be that the XML file doesn't actually create any visual content on the page? or doesn't have 'head' and 'body' tags?

It would be great if I could do all of this in PHP so that the final source would not include anything that would disrupt the final XML output.

View Replies !
Including A File (redirecting Using Header Command)
When including a file in the script or redirecting using header command, for example, should I use a file path:

../../x.php
or
ab/cd/x.php

say cd and ab are previously defined as constants that are the names of immediate parent directory and grandparent directory respectively, which one is better in design, using .. or using constants?

View Replies !
Executing External Programs
I know all the different functions that allow me to execute an external progam, however I have come across and interesting problem that I need to fix if it is at all possible.

Is there a way that I can use the php functions and execute an external program by some other user other then who ever owns the apache process?

View Replies !
Including External Pages
I've started a del icio us clone web site. I wanted to attach a small "if you like this site bookmark now" message at the top of the external page when anyone click them. I will reformat the outgoing links from URL to GO.php?URL=URL: I try require() first. At go.php when I call require("$URL") page shows up but relative links and images are broken. I try iframe but I don't want my message always displays (would be ugly). I don't want to use frame either.

View Replies !
Exec - Executing External Programs
I have problem with executing external programs...
The code:
system("/home/pkunzip /arch.zip /3");
Does not work properly (nothing doeing)...

The code:
system("dir /w");
Working very-very good

View Replies !
ImageMagick And Executing External Programs
I have installed ImageMagick and GhostScript (Windows/IIS) and IM is working from the command line (specifically the convert command) so now I need to get it working in php. To that end I have the following code:

<?php
system("c:Program FilesImageMagick-6.3.4-Q16convert.exe c:InetpubwwwrootexpgraphicsimgMagick est_file.ai c:InetpubwwwrootexpgraphicsimgMagickAIC.png",$retvar);
echo $retvar; // Now you can check the $retvar for errors
?>

c:Program FilesImageMagick-6.3.4-Q16convert.exe - the root folder for IM, location of convert.exe

c:InetpubwwwrootexpgraphicsimgMagick est_file.ai - the location of the target image to use for conversion

c:InetpubwwwrootexpgraphicsimgMagickAIC.png - the location, name, and format for the converted image

Using the above code, it does not create a new png image. Before I set the permissions for the Internet Guest Account user to "read & execute" for the cmd.exe file located at C:WINDOWSsystem32, $retvar was echoing a value of -1. Once I set the permissions on C:WINDOWSsystem32cmd.exe, $retvar is echoing a value of 1. In either case, the new graphic is NOT generated. Is there something wrong with my syntax?

View Replies !
Including External Html But Relative Links Are Broken
I wanted to attach a small "if you like this site bookmark now" message at the top of the external page when anyone click them. I will reformat the outgoing links from URL to GO.php?URL=URL

I try require() first. At go.php when I call require("$URL")  page shows up but relative links and images are broken. I try iframe but I don't want my message always displays (would be ugly). I don't want to use frame either. Can I include aspx or jsp pages too?

View Replies !
Executing A Shell Command
I try to use the backtick "`" to exacute a shell command from a PHP script. However, `touch file`; doesn't make the file. Neather does exec(), system(), etc. They all work when is used a different command, such as pwd, or ls. So what's a brotha gotta do to creat a file?

View Replies !
Executing Command Lines...
I'm trying to execute a command line through ffmpeg.exe in php. Can anyone tell me how this is done.

Also where should I have such an application installed relative to the root of the site?

View Replies !
Executing External Programs From PHP4 On Windows98 With Apache 1.3.14 For Win32
I did a search, and did not find anything specific on this topic, so here goes:

Trying to create a webpage button or link that when pressed executes Win98's "dialer.exe" with a phonenumber as a passed parameter. From my understanding, the exec function in PHP seems to work best with Linux (correct me if I am wrong please!). Are there alternatives?

The other bit of knowledge I have not been able to find (and really is outside this forum), is that dialer.exe is supposed to accept control from external programs, but I have yet to find docs or examples of such.

View Replies !
Problem With Executing A Command From Within My Script
I'm working on a web-based mail quarantine management system, and am
running into some problems getting it to run the command to release a
message.

The main exertp of the script is below:

<?php

echo "Releasing /var/amavis/quarantine/" . $_POST['release'] . " to
user " . $_POST['user'] . "<br><br>";
$command = "/usr/sbin/amavisd-release " . $_POST['release'] . " " .
$_POST['secretid'];
echo $command . "<br>";
passthru($command, $return_val);
echo "<br>" . $return_val;
?>

End script

This command works fine from the command line, but won't run using this
code. It comes back with a return code of 13 each time. I've also
tried the exec and popen functions in place of passthru() with no luck.
If it matters any, amavisd-release is an executable Perl script.

View Replies !
Exec Command Executing The Program In The Background
i am running xampp on my computer from apachefriends.org, it's a apache server

this is the php script

<html>
<head>
<?php

exec ('notepad');
?>
</head>
</html>

but when i execute the php script on my computer , notepad doesnt not run

i used a process viewer and discovered that notepad is running in the background and i cannot see it

does anyone know how NOT to make it run in the background? i wan to see the notepad window on the apache server (my computer)

View Replies !
Permission Denied Executing Shell Command
I am getting following error when executing shell command from PHP, where PHP/Apache is running as "nobody".

du: '/home/example/mail': Permission denied
du: cannot access '/home/example/mail/example.com/demo/': Permission denied.

View Replies !
External Command Prompt
I have a .bat file stored locally that I would like launched from PHP.

Here's the code I've tried using:

exec("cmd /K test.bat");

The PHP script that contains the code above hangs when executed. What is the correct way to do this? Or is there a way to have PHP display the output from the .bat file on the fly (as opposed to waiting for the .bat file to execute THEN dump the output?) .

View Replies !
Problem Executing Command Line Scripts On Win2003 IIS6 PHP4 Box
we're running an Win2003server with IIS6 and PHP4 in fastCGI config.
When i try to use system() command to execute ffmpeg.exe it works ok
when i run the PHP script from the commandline on the server, but when
i run it from the webbrowser i get a return value: 128 and nothing
happens. I checked for all the security settings, and everything seems fine.
Does anybody have a clue where i should be looking?



View Replies !
PHP CLI Command Line On Win XP Pro Calling External Page With CURL
I wanted to avoid using VBSCRIPT to process a local script running on a win xp pro box. Being that I know php pretty well, I thought I might try it to solve the problem of not knowing vbscript.

I have it running fine on this machine. even have it so I can just type in the php script name instead of c:/php5/php.exe before the script. Cool stuff.

I need to call a php script on another server when this runs and receive a response. (preferrably using POST). I had a test working with vbscript using MS's XMLHTTP.

Not knowing what else to use. I got a quick test working with cURL but it doesnt seem to like the curl_setopt settings. without them, it calls the page (As GET) and receives a response.

So my question is. is there a better method than CURL to receive a response from a script running on the command line? and how can I get it to use POST if I cant use curl_setopt.

View Replies !
Use The Php Include Command In Source Code To Insert External Page
Hello, i am trying to use the php include command in source code to insert external page when a main page loads, but get the following errors.. can you help?

View Replies !
Command-line Php Displays Code Instead Of Executing Code
I am using CLI PHP to run a PHP script, c:wampphpphp.exe, but
instead of executing my script, it's actually displaying the raw code
instead.

How can I run my code using CLI PHP? I installed WAMP5 on WinXP.

View Replies !
How Can I Find Out Parent (including) File Of Included File?
How can i find out parent (including) file of included file?
Lets imagine that we want to for example auto_prepend file to each file on our server that would write out the name of file  its being executed. I know, i can use PHP_SELF but what if i want to write name of file which is already included?

I have a web page and i want on it show its name even if it was included, but not the included page itself is showing name but auto_prepend file to each php file, its duty of this auto_prepend_file to write it out i dont want myself to echo it on each page? do you feel me?

View Replies !
How To Get File Name From Which Current Executing File Is Invoked???
how can i get the file name from which the current executing file is
called.
i m making a scrript which will be called from many other scripts.
this script performs some calculation and then returns the result to
the script who asked for. so i want to know the script name of caller
script in the current executing script

View Replies !
SSI Including PHP File Within PHP File Causes Seg Fault And Crash
Can somebody concur or verify the following? I'm having this problem on all
of my installations.

I've got Apache 2.0.40 and PHP 4.2.2 installed and configured from RedHat
RPMs. Nothing out of the ordinary. In the httpd.conf file, PHP files are
called with the following:

<Files *.php>
SetOutputFilter PHP;INCLUDES
SetInputFilter PHP
LimitRequestBody 524288
</Files>

I create two files as follows:

/test1.php
<!--#include virtaul="/test2.php" -->

and

/test2.php
Testing 1 2 3

By going to http://host/test1.php, it may or may not display the file
contents of test2.php. Usually (9/10 times) I get a seg fault in the error
log. If I change the filename of test.php to test.html and include that, it
works fine. I've tried this on various versions of both Apache and PHP up
to the most recent CVS versions and still get the same results.

View Replies !
Executing An SSI Within A Php File.
I have the following line in an old shtml file:

<img src="http://www.domain.com/cgi-bin/logtrack/log.pl?ref=<!--#echo var="HTTP_REFERER"-->" width=1 height=1 border=0>

What this does is execute log.pl with the refererer to increment a logtracking program and find out what their referer is. How would I go about porting this to php?

View Replies !
Executing A .bat File With PHP
I have a .bat file that copies certain files across a network and I needed a way to run this file using PHP.  I was looking at exec() but I was not sure exactly how to use it.  I was also using pstools but could not get them to work with PHP.  Can someone give me an example of how to do this or send me somewhere where I can read up on this?

View Replies !
Executing .sql File
how may I execute .sql file using php?

View Replies !
Executing A Php File
I'm trying to execute a php script on my linux server whenever I view a different page. So far this is what put on that page: PHP Code:

<?php exec('php  /var/www/html/execute.php'); ?>

I am trying to be logical with how linux executes php and the path to the file I wish to execute. But this was a best guess. So far it isn't doing anything, but I'm also getting no errors in the logs.

View Replies !
Get Executing File
Is it possible for php to tell the path to the file (php path, not html) that is currently executing? What I mean is, if I include() a file and in that included() file I call $_SERVER["PATH_TRANSLATED"] I get the path to the file that the include() is called in, not the path of the included() file that calls $_SERVER["PATH_TRANSLATED"].

View Replies !
Including A File
I am attempting to include a file, but it is not working so well.

Here is my direcoty structure.

Root
|-/file_man
   |-/functions
   |  |-/index
   |     |- top.x
   |-/files
      |-/users
        |-index.php


I am trying to call top.x from index.php using require, but it doesnt work like this

require("/file_man/functions/index/top.x");

any thoughs?

View Replies !
How Can I Do Cron Job For Executing My PHP File
How can i do cron job for executing my PHP script once in every day. i want to remind the people about their birthday in reminder.php. that would be one week before thier birthday and one day before their birthday. can i perform this action with cron job?

View Replies !
Executing A Dump.sql File With Php
Is there an easy way to execute a mysql dump located in the same directory as the php file on unix?

View Replies !
Problem Including The Other Php File.
I want to include three php files in index.php file like the code below. But
it always shows up only two, any two of the three, any order.

<tr>
<td><?php include ("includes/documents.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?>&nbsp;</td>
</tr>

Can anyone help me out?

View Replies !
Including Txt Html File
I'm converting all my pages to php from shtml files. How can I include the txt files for different parts of the site using php rather than using the includes that I had before?
The text file that I'm using is for the menu and in the text file is all the html for the menu.

View Replies !
Including A .php File From Another Server?
I am trying to include a function in a .php file on a different server from
the main .php files.

I am using:

include_path=http://www.anotherserver.com/foldername;
include(http://www.anotherserver.com/folder...iletocall.inc);

The .inc file is php formatted. Variables are passed to it (not via GET or
POST though) and returned using return(variablenames, etc);

But for some reason it doesn't appear to work properly.

Am I correct in using the .inc extension?
Are the commands above correctly written?

Basically I am trying to use the fsockopen function in a .php file on
another server where I know it works and return the results to a server
where the fsockopen command doesn't work.

View Replies !
Including A File In Another Frame
I've the following code:

mainpage.php
----------------------------
<FRAME name="framesuperior" src="framesuperior.php?a_caller=inicio">
<FRAME name="framecatalogo" src="frameinferior.php?a_caller=inicio">
----------------------------

framesuperior.php
----------------------------
$a_caller = $_GET['a_caller'];
$a_dhn = $_GET['a_dhn'];

if ($a_caller=="menuprincipal"){ //this file could be called from
another files
include("menusecundario.php"); //this line will update
framesuperior.php
***** Here I need to include "file.php" but in "framecatalogo"
frame

}

View Replies !
Only Including Certain File Types
I have this code which i have taken from php.net and am hopin to have someone tell me how i could modify it to display only one file type (.mid) also this is to stop the script from displaying other directorys as they will automatically load up the index of that directory and won't display a list.

<?
$the_array = Array();
$handle = opendir('/home/www/juttuffi/midi/files');
while (false!== ($file = readdir($handle))) {
if ($file!= "." && $file!= "..") {
$the_array[] = $file;
}
}
closedir($handle);
sort ($the_array);
reset ($the_array);
while (list ($key, $val) = each ($the_array)) {
echo "<a href=http://example.co.uk/midi/files/$val target=_blank>$val</a><br>";
}
?>

View Replies !
Including A .htm File Using An Absolute URL?
i've done some searches on this but most of the stuff i find are to do with including dynamic files and other such advanced PHP which i neither understand nor need. im just a beginner with PHP and actually, this is all im using it for.

so my question is, can i include a .htm file if its on a different server as the php file? im doing it this way because my hosting service doesnt allow SMTP, and the service i hosted the PHP script on, has ads and ruins everything. Code:

View Replies !
Including A File From Mydomain.com
I have a site domain.com that i want to let access some information on a database. So what I am doing is this on domain.com/reg.php I am including a file from mydomain.com that accesses the database. But it isn't printing anything. I am just using

<?
include("http://www.mydomain.com/file.php");
?>

whichi is a simple list from the database.

View Replies !
Error When Including File
Warning: main(1): failed to open stream: No such file or directory in /hsphere/local/home/dezmar/netwack.com/main.php on line 2

Warning: main(1): failed to open stream: No such file or directory in /hsphere/local/home/dezmar/netwack.com/main.php on line 2

Fatal error: main(): Failed opening required &#391;' (include_path='.:/usr/local/lib/php:/usr/local/lib/php/PEAR:/usr/local/share/pear') in /hsphere/local/home/dezmar/netwack.com/main.php on line 2

Those are the errors that i'm getting when loading up my page. How would I fix something like this? Code:

View Replies !
Including A File Referenced
Why does this find the file:

<img
src="<?=$_SERVER['DOCUMENT_ROOT']?>/images/viessmann_header_logo.gif">

But this does not?

$right_content =
$_SERVER['DOCUMENT_ROOT']."includes/content/content.php";

include $right_content;

View Replies !
Including A File Within A Function
I want the variables of the included files to work directly without passing them again to the function my code is not working when the file is included inside the function e.g.

<?
function testing ()
{
include( 'include/session.php' );
echo $session->username;
}
testing();
?>

View Replies !
Executing A File When A Button Is Clicked
I was wondering if someone could help me. I want to execute a .reg file when the user clicks a certain button. does anybody know how to do this. i already have the file created but i don't know the code to execute it if button clicked.

View Replies !
Problem Including File (intermediate)
I wonder if someone can help me, I've set my web site up as follows:
There is a 'services' page that displays .html pages in a sub-dir when
specified in the URL. I need use the switch function as the code
following shows:

<?php if(isset($_GET['p']))
{
switch ($_GET['p'])
{
// include ('test.inc');
case "test": include "./services/test.html"; break;
case "2test2": include "./services/2test2.html"; break;
default:
}
}
else
{
echo "<p><br><br><B>Please choose a topic from the left</B></p>
";
}
?>

Basically.. I want to use the include(test.inc) file which contains
the two lines of code following it. But I get an error:

Parse error: parse error, expecting `T_CASE' or `T_DEFAULT' or `'}''
in /home/rmgraphics/public_html/services.php on line 27
- which is the include page line and I've commented out for now

I need to use the test.inc file for the case lines because I want to
manage the list by opening the file direct.

View Replies !
Including File And Output To Browser
I am not sure I understand the rules as to what exactly gets output to a
browser and when. If I include a text only file or an html file, these will
show up in the browser regardless of where in the script they are included.

View Replies !
Including Database Config File
I'm facing a problem with including the database config file..

I kept database variables in a config file like this..

connect.php
<?php
$dbhost='something'
$dbuser='something'
$dbpass='something'
$dbname='something'
?>

then in my home.php file I've included that file ( both connect.php and
home.php are in same folder );

<?php
include 'connect.php'
$db=mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname,$db);
//some actions
?>

The above thing worked fine until I moved the config file to root
directoryso that It will be available to all scripts..

the changes I've made to the script.. home.php

<?php
include 'http://domain.com/connect.php'
$db=mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname,$db);
//some actions
?>

the above code this throwing errors..

View Replies !
Including Part Of An HTML File
Is it possible to include part of a file without including the whole thing?

View Replies !
Including A Standard File In All Directories
I have one layout page that all directories use on my website. How can I make it so that no matter where the file is, the server will always include it. I cannot use direct paths because php will not allow it, and I can't specify the directory for each file. Example.

Layout.php includes files/header.php which includes lib/main.lib.

in Pages/Path/index.php I include ../../Layout.php. Than Layout.php's includes are all messed up.

View Replies !
Including An Html File In Php Script
how would i include a file that contained all the html code for the display of a webpage in a php fifle so that i dont have to clutter the php with the html.

View Replies !
Including Php File With Str_replace / Ereg_replace
I'm trying to include a php file at a certain point in my template. Including works fine, just it doesn't place it at the right place where I want it to be. The news.php file will be included up front and not at the desired place {content} where it should go to.

I tried str_replace instead of ereg_replace, but str_replace displayed only the news.php page and truncated the rest of the page. Code:

View Replies !
Including Parts Of A Text File
is there a way so that i could only include the first 5 lines of a txt file and have them automaticly break at the end of each line?

im trying to include the first 5 lines from a log file into a server monitoring script im working on.

View Replies !
Class File And Including A CSS Style
I have a class file which contains the classes for the frontend of the site. In some of the functions there are links to various different things.

I tried adding a class attribute onto the link but it doesn't work. So I tried including/requiring the class file and that did nothing but spit the code out onto the page. Any idea what I can do to fix this?

View Replies !
Require_once() Dumping Text Instead Of Including File
Instead of actually including the file i'm requiring, it just dumps it out as text...

other functions are working quite well...

the code look like this:

$forum_version = 'SMF 1.0 RC2'

// Get everything started up...
define('SMF', 1);
@set_magic_quotes_runtime(0);
$time_start = microtime();

// Load the settings...
require_once(dirname(__FILE__) . '/Settings.php');
error_reporting(isset($db_show_debug) && $db_show_debug === true ?
E_ALL : E_ALL ^ E_NOTICE);

// And important includes.
require_once($sourcedir . '/QueryString.php');

After this line:
require_once(dirname(__FILE__) . '/Settings.php');

It just displays the contents of Settings.php as text to the browser - no code execution...
Although dirname(__FILE__) works fine and actually returns the correct directory name of the current file, so i can't really tell if it's a problem with php code execution in general or just this function (require_once)...

View Replies !
Exec And Shell_exec Not Executing Batch File Properly
I am running Apache and PHP on windows XP. Latest versions of them all. I am trying to execute a simple .bat batch file that simply copies 4 files from one location to the batch files location.

The php exec command runs like this:
V:Corehtdocswp ransfer.bat Y:folder

here the batch file is executed and the command following is thrown into the batch file to specify where the files that need to be copied are.

The Y: directory is in windows considered to be a network drive, although it is really just a folder on the same machine, i did this because there are spaces in the folder names on its way to where I need the information copied from i.e. "Program Files"

When I run this in the command prompt by entering this in manually it runs perfectly. However when running exec in the PHP script nothing happens; when I run shell_exec it gives me the output and it shows that every line in the batch file is executed however it does not actually copy anything.

Looking into my apache error log I see that this is related:

"The system cannot find the drive specified."

Now what I am wondering is, how is it that I can run this script manually but apache tells me I cannot. My permissions are set to allow all and deny nothing since it is a machine well tucked into a safe place.

Apache resides on the machine in C:

eactorcore and it also setup a virtual drive as v:core. Trying both does not work.

View Replies !
External PDF File
Is there a way for me to be able to fetch a PDF from another site and display it on my website without having to open up Adobe Reader?

In other words, I would like to have this PDF document: http://flightaware.com/resources/airport/ASE/APD/AIRPORT+DIAGRAM/pdf

to be displayed on a page when a user opens a page on my website.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved