RE: Include Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Wei, Alice J. [mailto:ajwei@xxxxxxxxxxx]
> Sent: Tuesday, June 24, 2008 3:11 PM
> To: Boyd, Todd M.; php-general@xxxxxxxxxxxxx
> Subject: RE:  Include Problem
> 
> ________________________________________
> From: Boyd, Todd M. [tmboyd1@xxxxxxxx]
> Sent: Tuesday, June 24, 2008 2:53 PM
> To: php-general@xxxxxxxxxxxxx; Wei, Alice J.
> Subject: RE:  Include Problem
> 
> >
> > > If you are trying to include() a remote file via HTTP, the remote
> > > server
> > > will (most likely) translate the PHP code into the output that it
> > would
> > > produce if you were to visit the script with a web browser. It
> > appears
> > > you are trying to grab a PHP file from a remote server and execute
> it
> > > as
> > > code, which won't work--at least not under normal circumstances.
> >
> > Alice,
> >
> > If the two Windows machines are on the same network, you can try to
> use
> > Windows' file sharing to do the job for you. For instance,
> >
> > include('\\servername\dirname\filename.php');
> 
> *cough* ... I meant to double up on those backslashes. I'm not sure if
> PHP supports forward-slash file/dir specifications in Windows, but to
> double them all up would look like this:
> 
> Include("\\\\servername\\dirname\\filename.php");
> 
> > Using HTTP from Windows to Windows would yield the same results as
> > using
> > HTTP from Linux to Windows. You could host the files on a server
that
> > does not parse PHP, and so they would be transmitted as plain
text...
> > but then you get into issues of disclosing their contents to parties
> > you
> > would rather leave in the dark (read: hackers).
> >
> > You might consider using FTP, SCP, or another behind-the-scenes file
> > transfer agent to accomplish what it is you're trying to do. I
> believe
> > PHP already has several functions for use with FTP.
> 
> Sorry, I don't think I am intending on passing any file to whatever
> server.
> 
> All I need to do is to have my script be able to execute another
> program that can allow my  PHP script to pass the variables, so this
> may be using anything from PHP, Perl to C. I have seen in the PHP
> manual that there is this command called exec().
> 
> Is it possible that I could use something like exec($someurl) to
> execute the script? I tried doing this in PHP, but it tells me this:
> 
> arning: exec() [function.exec]: Unable to fork
> [http://www.mysite.com/calculate.php] in C:\Inetpub\wwwroot\read.php
on
> line 31
> 
> Is there some way I can fix this error somehow? Or, is this not
> possible either?

Alice,

If you simply need to execute a remote PHP script and pass variables,
you could do it behind-the-scenes with cURL or AJAX, and pass the
variables in the url (i.e.,
http://www.mysite.com/script.php?param=value). cURL is capable of
retrieving the page (read: the results of the executed script), which
can then be parsed by your local script.

I actually did something like this where I scraped the World of Warcraft
Armory (ok, groan. No, seriously, let it out). I grabbed their XML
pages, parsed the info, and then pushed this info to a script on a
remote site of mine. I had to do this because the remote site I was
working with did not have cURL installed (nor could I install it myself
due to access restrictions). The remote script would return "OK" or
"FAIL", and my script would expect one of these values and react
accordingly.

Is this a little bit more on target? I can supply you with source code
if you would like.

You could also use AJAX to populate an IFRAME with the results of a
remote PHP script, and then parse those values using a hidden form
submission, perhaps. Just some ideas.

HTH,


Todd Boyd
Web Programmer




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux