473,657 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sending basic data between php functions on internet

Hey can U help me with the following?

I would like to send basic data (like a set of integers & strings) from
one php function to another php function.

Sounds easy, However, the functions are located on a different computer.

Or, said differently, I would like to use

function oncomp1($intege r1, $string1, $string2)
{
// ...
//string3 = function of string2

//<-- call oncomp2($string 1,$string3,$int eger1);
}

where function oncomp1 is on computer 1, and oncomp2 is on computer 2.

What to do?
The strings can be to long (a few kb) to pass it simply in the URL.
However WDDX is heavily overkill, because u need to compile php with
--enable-wddx to use those functions. And WDDX do not cover communnication.

Greetings,
Edwin
Jul 17 '05 #1
4 1607
Edwin Rozie wrote:

Hi Edwin,
Hey can U help me with the following?

I would like to send basic data (like a set of integers & strings) from
one php function to another php function.

Sounds easy, However, the functions are located on a different computer.

Or, said differently, I would like to use

function oncomp1($intege r1, $string1, $string2)
{
// ...
//string3 = function of string2

//<-- call oncomp2($string 1,$string3,$int eger1);
}

where function oncomp1 is on computer 1, and oncomp2 is on computer 2.

What to do?
The strings can be to long (a few kb) to pass it simply in the URL.
However WDDX is heavily overkill, because u need to compile php with
--enable-wddx to use those functions. And WDDX do not cover
communnication.
Why not post it to a receiving script on server2?
You can mimic a posting using CURL.
www.php.net -> find CURL

Good luck!

Regards,
Erwin Moller


Greetings,
Edwin


Jul 17 '05 #2
> Why not post it to a receiving script on server2?
You can mimic a posting using CURL.
www.php.net -> find CURL


I remember that I've found a PHP script that mimics posting. It's
somewhere on www.php.net, in user comments under "POST" I believe.

Cheers
Mike

Jul 17 '05 #3
Hey all :)

Michał Woźniak wrote:
I remember that I've found a PHP script that mimics posting. It's
somewhere on www.php.net, in user comments under "POST" I believe.

Do u remember more details about the script? I readed
http://be.php.net/variables.external completly and didnt found it.
Google couldnt help me neether, I tryed multiple searches.

Thx for helping me out!
Jul 17 '05 #4
Michał Woźniak wrote:
Why not post it to a receiving script on server2?
You can mimic a posting using CURL.
www.php.net -> find CURL

I remember that I've found a PHP script that mimics posting. It's
somewhere on www.php.net, in user comments under "POST" I believe.


Ah, I found it :)

For the people who want to use this in the future: It is in a reply of
lukas on http://be2.php.net/manual/en/ref.curl.php.

The script is:

<?
function HTTP_Post($URL, $data, $referrer="") {

// parsing the given URL
$URL_Info=parse _url($URL);

// Building referrer
if($referrer==" ") // if not given use this script as referrer
$referrer=$_SER VER["SCRIPT_URI "];

// making string from $data
foreach($data as $key=>$value)
$values[]="$key=".urlenc ode($value);
$data_string=im plode("&",$valu es);

// Find out which port is needed - if not given use standard (=80)
if(!isset($URL_ Info["port"]))
$URL_Info["port"]=80;

// building POST-request:
$request.="POST ".$URL_Info["path"]." HTTP/1.1\n";
$request.="Host : ".$URL_Info["host"]."\n";
$request.="Refe rer: $referer\n";
$request.="Cont ent-type: application/x-www-form-urlencoded\n";
$request.="Cont ent-length: ".strlen($data_ string)."\n";
$request.="Conn ection: close\n";
$request.="\n";
$request.=$data _string."\n";

$fp = fsockopen($URL_ Info["host"],$URL_Info["port"]);
fputs($fp, $request);
while(!feof($fp )) {
$result .= fgets($fp, 128);
}
fclose($fp);

return $result;
}

$output1=HTTP_P ost("http://www.server1.com/script1.php",$_ POST);
$output2=HTTP_P ost("http://www.server2.com/script2.php",$_ POST);
?>
Jul 17 '05 #5

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

Similar topics

1
14517
by: coder_1024 | last post by:
I'm trying to send a packet of binary data to a UDP server. If I send a text string, it works fine. If I attempt to send binary data, it sends a UDP packet with 0 bytes of data (just the headers). I can see this because I'm running Ethereal and watching the packets. I'm defining the packets as shown below: $text_msg = "Hello, world\r\n"; $binary_msg = chr(0x01).chr(0x02).chr(0x03).chr(0x00).chr(0xA0); $binary_msg_size = 5;
2
2303
by: Frostillicus | last post by:
I'm trying to get an ASP to return a zip file to the remote browser from an Image (BLOB) field in SQL Server 2000 but Internet Explorer keeps saying: Cannot open C:\Documents and Settings\Frostillicus\Local Settings\Temporary Internet Files\Content.IE5\U7GXENGF\file.zip The URL to open the zip file is like this: doc_view.asp?id=1&ver=2 ....where id and ver represent the zip file's version in the database. The code I've pieced...
2
1613
by: Joel Vazquez | last post by:
Visual Basic.NET Application RunTime Crashes and Stalls Im a newbie if you could say in .NET ive been working with it the past 3 months and have done lots of things with it, without any prior knowledge. I have a few question regarding the stability of my application. I have a synchronization application that connects to a service and send the results to SQL Server 2000. I got all my code in just one form.
2
2523
by: Fernando Barsoba | last post by:
Dear all, I have been posting about a problem trying to encrypt certain data using HMAC-SHA1 functions. I posted that my problem was solved, but unfortunately, I was being overly optimistic. I am really desperate now, because I havent' been able to locate the origin of the problem for a couple of days now.. PROBLEM: the message digest obtained differs each time I execute the code, but works perfectly when applying the "control", that...
13
3024
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format for accessing objects, controls, etc. in VB/Access2003. In particular where will I find explanations of:- Actions, Functions, Methods, Properties - I'm understand the
0
1159
by: Jonathan Woods | last post by:
Hi there, I have encountered problem of losing data sending over internet using web service. I consume web service that connected Oracle Database. I submit 687 SOAP Messages to 1 Web Method concurrently. (With synchronize method) public bool SubmitDPSuccessResult(string dpNo,string tkNo,string plNo,string siteNo,int tid )
19
11213
by: ... | last post by:
Hi I need to send a chr(255) to a serial port. When I send it, through comm.write (chr(255)) it sends a chr(63) ... in Hex, I write chr(&FF) and it actually sends chr(&3F) ... why does this happen, and how can I send it right ? I'm using vb.net 2005 express with framework 2.0 Thanks for an answear ...
4
12072
by: david | last post by:
hello, I have a client/server application. the server capture picture from webcam and send it to every client connected to it.the network part works good and the capture from webcam too. I associate an event when a capture is done, then every frame of the webcam should be sent to the client. but I cannot find a way to send bitmap throught network, of course I found many method from internet, some doen't work, some work but it's never...
0
2241
by: vigneshrao | last post by:
Hi, I have been working on a script that loops through multiple records and sends data (one record per call) to a WS. I am supposed to make a new call for each record before sending the data. The problem I have is the first record gets processed fine where as the second record always; reason being the EAI expects it to be a seperate call Though I am creating/reseting a new service everytime within the foreach loop the data seems to be...
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.