![]() |
PHP assistance needed - experts only please!
Hi,
My name is Betty and I need some help. I want to send a data string from a php file on 1 server to another php file on another server. example: Server 1 / file1.php -> Server 2 / file2.php Server 2 / file2.php -> Server 1 / file1.php It's actually posting data to another file on another server and getting the result. Thank you, Betty :( |
use curl within php to post to the other server/script
|
I am afraid to use curl since some servers might not support it.
|
|
most servers have curl installed. If you dont wanna use the php extensions, use curl from cli using exec();
|
Hi!
The most easy way is this: Server 1: Code:
<?php Code:
<?php |
"Experts only" for simple questions, please!
:1orglaugh I'm not making fun of you, it just made me chuckle. |
Quote:
Thank you, but I don't understand. I need to send data to the other server and accourding to this data perform an action. I didn't mean to just read the data as is on the other server. |
wait a second, a girl who codes?!??
hot. |
Is this data from a database? If so just give the server that needs the data proper access privileges in MySQL and vice versa. Depending on the data you might even be able to do it with fopen and query strings. It's hard to give you advice without knowing the exact situation.
|
Quote:
You can use a regulare header post configuration, Curl is nothing more then a automated system for regular header commands. It can be done manually aswell. |
I don't want to give server1 access to the database.
|
Quote:
|
<? exec("curl -d \"foo=bar&bar=foo\" \"urltootherfile\""); ?>
|
Quote:
|
Quote:
1. Do you know if there is a limit to the length of the string. foo=$report, what is the maximum length of $report ? 2. How do I get the returned value? |
Quote:
But what do I know, I'm just a pert not an ex-pert. :helpme |
Quote:
|
Code:
function HTTPS_Post($URL, $dat, $referrer="") |
Ok, several people have asked you more more info and you aren't really offering anything up, so I will offer up what I think is the simplest solution, however, it would help to know what you are actually trying to do.
This is a 2 script solution. script1 is on server1, script2 is on server2. Script1 is kicked off somehow (depending on what you are doing) either a call from a browser, a post action in a form, a cron job, whatever. script1 collects or retrieves data (whatever your initial data source is) script1 writes the data to a file on server1 (or could write it via ftp it to server2) script1 then does an fopen() to script2 on server2 script2 opens the file created by script1 whether via fopen() to the url for the file on server1 or an fopen() to the file where it was written on server2 script2 performs whatever steps are required to be performed on the data (writes it to a database, performs verification, jerks off to it, whatever) script2 returns a done message (which could be the results of the steps performed in script2). done. There are, as people have said, many different ways to skin this particular cat. It seems to me though, from watching this conversation, that you need to draw out your step by step of what you are actually trying to do. just my :2 cents: |
Code:
$options = array( |
Quote:
Thank you, Yours script works great and does exactly what I need.:thumbsup |
I would like to thank you all for your help. I appreciate it.
For all of you that didn't understand me for asking experts help, I didn't mean to insult you, but before I have tried to post this question on another form and got answers that didn't help much, so I though I would need an expert for that. Thanks again, Love, Betty.:) |
Quote:
|
Quote:
|
All times are GMT -7. The time now is 06:43 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123