473,395 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Calling PHP script on a second server

The problem:
I have script_1.php on a server. I'd like to call a script_2.php which
is on a second server (remote one). Script_2.php is to do some
processing on a second server and return results to script_1.php.
Basing on the results script_1 goes on, using the results.

Is a construction in script_1.php

...
require("second server…/script_2.php");
...

a good direction? (I need environment variables in script_1.php to be
preserved after calling script_2.php). Or the problem needs quite
different solution?

Thanks in advance

Marek Kotowski
Warsaw
Jul 17 '05 #1
2 1240
Marek Kotowski wrote:
The problem:
I have script_1.php on a server. I'd like to call a script_2.php which
is on a second server (remote one). Script_2.php is to do some
processing on a second server and return results to script_1.php.
Basing on the results script_1 goes on, using the results.

Is a construction in script_1.php

...
require("second serverÂ…/script_2.php");
...

a good direction? (I need environment variables in script_1.php to be
preserved after calling script_2.php). Or the problem needs quite
different solution?

Thanks in advance

Marek Kotowski
Warsaw


Hi Marek,

This is the kind of thing PHP rocks at. :-)

lookup file at www.php.net

(from script 1)
$lines = file('http://www.marek2.com/myotherscript.php');

'file' returns an array with results.
So you let PHP wrap the URL and take care of the difficult stuff, so you can
just enjoy the result easily ordered in $lines.

Good luck!

Regards,
Erwin Moller

PS: If you want to pass more info, just URLencode it:
$lines =
file('http://www.marek2.com/myotherscript.php?firstname=Marek&country=Poland') ;
Jul 17 '05 #2
Erwin Moller <si******************************************@spam yourself.com> wrote in message news:<42***********************@news.xs4all.nl>...
Hi Marek,

This is the kind of thing PHP rocks at. :-)

lookup file at www.php.net

(from script 1)
$lines = file('http://www.marek2.com/myotherscript.php');

'file' returns an array with results.

[...]

Hi Erwin,

It works. I get all html stuff, wchich is sent
by a script, but - most important - I can include
in it my own special markers with info I need.
That's enough. I'll use the method.

Many thanks :-)

Marek Kotowski
Warsaw
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: deko | last post by:
In regard to running php scripts with cron - Here is a sample script: <?php //debug.php echo "<br> This is a test"; ?> I can call debug.php from a web page on my site like this:
16
by: Fox | last post by:
I merged and modified these script which work perfectly fine as long as I use server.execute to access the VBS part (which is itself in another ASP file). When these I use a session variable to...
4
by: Simon Wigzell | last post by:
My webpage assembles data from a database for display as an html webpage. I would to have the ability for my clients to have custom scripts to control the display. I would like the behaviour of...
1
by: Martin | last post by:
Hi I'm having trouble with the script below that it just won't do a correct ORDER BY for a date field. When executing the two SELECT TOP statements on their own the records are sorted...
4
by: Smoke | last post by:
We had a javascript calling a Cold Fusion page (.cfm) and it was working for 2 years. Suddenly yesterday or today its decided it doesn't want to work anymore. I'm picking up somebody elses code I...
8
by: Vinod | last post by:
Hi, I have a problem, i am calling an exe from asp program. Its not working fine. When i execute the exe through the dos program directly i get the desired result. My exe will convert files in...
6
by: szabelin | last post by:
Hello, I am trying to call a function inside the javascript block from asp.net during the postback (NOT button's OnClick event handler though). The javascript function creates new popup window. I...
6
by: evandelagrammaticas | last post by:
Hi all. I have spent the better part of a day scouring the newsgroups and I am sure that I must have come across the solution a number of times - but I am still a real newbie at asp.net so please...
2
by: Ravi | last post by:
Hi, I am trying to call an aspx page from an htm file. I have written something like this in my htm file <script src="Test.aspx"></script? The Test.aspx page should call a javascript function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.