|
|
|
|
|
|
| Author |
Message |
simon *nix forums beginner
Joined: 25 May 2005
Posts: 40
|
Posted: Wed Feb 02, 2005 2:24 pm Post subject:
Passing data from one site to another
|
|
|
Hi,
I run a few sites and I want to log in my main site database when/if there
is a problem, (like a page not found or an unknown agent).
But I don't want to give direct access to my database to the other sites, so
how could I safely pass data, (without passwords), from one site to another?
Thanks.
Simon |
|
| Back to top |
|
 |
ppalmieri@gmail.com *nix forums beginner
Joined: 02 Feb 2005
Posts: 1
|
Posted: Wed Feb 02, 2005 4:59 pm Post subject:
Re: Passing data from one site to another
|
|
|
i think i follow your question,
Something i am doing is i built a listener...
www.page12.com/errors.php (not a real url)
then in all my apps, i have an error class-- then i curl with a post
to errors.php.
i also use this for other stuff like tracking and all
Phil
Florent wrote:
| Quote: | Hi,
I run a few sites and I want to log in my main site database when/if
there
is a problem, (like a page not found or an unknown agent).
But I don't want to give direct access to my database to the other
sites, so
how could I safely pass data, (without passwords), from one site to
another?
Thanks.
Simon |
|
|
| Back to top |
|
 |
simon *nix forums beginner
Joined: 25 May 2005
Posts: 40
|
Posted: Wed Feb 02, 2005 5:12 pm Post subject:
Re: Passing data from one site to another
|
|
|
| Quote: | i think i follow your question,
Something i am doing is i built a listener...
www.page12.com/errors.php (not a real url)
then in all my apps, i have an error class-- then i curl with a post
to errors.php.
i also use this for other stuff like tracking and all
Phil
|
No, What I mean was if site A wants to send data to site B.
I guess I could "www.B.com/msg.php?a=10"
but what I was really after is site A sending long information to B without
redirecting to A
Simon |
|
| Back to top |
|
 |
NC *nix forums Guru
Joined: 22 Feb 2005
Posts: 446
|
Posted: Wed Feb 02, 2005 6:01 pm Post subject:
Re: Passing data from one site to another
|
|
|
Florent wrote:
| Quote: |
I run a few sites and I want to log in my main site
database when/if there is a problem, (like a page not
found or an unknown agent).
But I don't want to give direct access to my database
to the other sites, so how could I safely pass data,
(without passwords), from one site to another?
....
What I mean was if site A wants to send data to site B.
I guess I could "www.B.com/msg.php?a=10"
but what I was really after is site A sending long
information to B without redirecting to A
|
This is entirely possible, but will likely result in a
performance drag. If you are prepared to live with it,
here are a few recommendations.
The easiest thing to do would be to implement a report
generator of sorts on site A and have site B request
reports by name. Example:
Site B code:
readfile('http://www.siteB.com/report.php?id=status');
Site A code:
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
die();
}
switch($id) {
case 'status':
$query = 'SELECT this FROM that ...';
break;
// many other cases here...
default:
die();
}
$result = mysql_query($query);
while ($record = mysql_fetch_array($result, MYSQL_NUM)) {
echo "<tr>\r\n";
foreach ($record as $field) {
echo "<td>$field</td>\r\n";
echo "</tr>\r\n";
}
}
In other words, site A would return fully-formatted HTML in
response to a request from site B. Alternatively, you can
return comma-separated or tab-delimited text and have it
formatted on site B.
A less secure alternative is to send actual queries from
site B to site A. The danger is that a hacker could send
a query which would destroy or modify your data. So if
you want to go this route, you will have to make sure that
the report generator script connects to the database as a
user with SELECT-only rights.
Finally, you can implement a Web service with a similar
functionality...
Cheers,
NC |
|
| Back to top |
|
 |
simon *nix forums beginner
Joined: 25 May 2005
Posts: 40
|
Posted: Thu Feb 03, 2005 9:52 am Post subject:
Re: Passing data from one site to another
|
|
|
| Quote: | This is entirely possible, but will likely result in a
performance drag. If you are prepared to live with it,
here are a few recommendations.
|
Looking at your example I am not sure I understand where there would be a
performance lag.
| Quote: |
The easiest thing to do would be to implement a report
generator of sorts on site A and have site B request
reports by name. Example:
Site B code:
readfile('http://www.siteB.com/report.php?id=status');
|
don't you mean 'www.siteA.com' rather?
Site B will request from SiteA...
| Quote: |
In other words, site A would return fully-formatted HTML in
response to a request from site B. Alternatively, you can
return comma-separated or tab-delimited text and have it
formatted on site B.
|
Does it really have to be html, CS or TD text?
Can it not be any format I like? The reason I ask is that I could return
encrypted text of some sort to be certain that the data is 'fairly' safe.
| Quote: |
A less secure alternative is to send actual queries from
site B to site A. The danger is that a hacker could send
a query which would destroy or modify your data. So if
you want to go this route, you will have to make sure that
the report generator script connects to the database as a
user with SELECT-only rights.
|
I don't think i wwill go down this road.
| Quote: |
Finally, you can implement a Web service with a similar
functionality...
|
A biut of an overkill wouldn't it be?
Many thanks,
Regards
Simon |
|
| Back to top |
|
 |
NC *nix forums Guru
Joined: 22 Feb 2005
Posts: 446
|
Posted: Thu Feb 03, 2005 5:02 pm Post subject:
Re: Passing data from one site to another
|
|
|
Florent wrote:
| Quote: |
Looking at your example I am not sure I understand where
there would be a performance lag.
|
OK, if you allow site B direct access to site A's database
server, here's what going to happen:
1. Site B opens a TCP connection to site A's database
server.
That's it; a single step.
If you prefer to go through site A as an intermediary,
there's going to be an extra step involved:
1. Site B opens an HTTP connection to site A.
2. Site A opens a TCP or socket connection to its database
server.
Opening a connection takes time. In the first scenario,
only one connection needs to be opened. In the second
scenario, two connections need to be established.
NC> Site B code:
NC>
NC> readfile('http://www.siteB.com/report.php?id=status');
| Quote: |
don't you mean 'www.siteA.com' rather?
Site B will request from SiteA...
|
Of course. My apologies for confusion.
NC> In other words, site A would return fully-formatted HTML in
NC> response to a request from site B. Alternatively, you can
NC> return comma-separated or tab-delimited text and have it
NC> formatted on site B.
| Quote: |
Does it really have to be html, CS or TD text?
|
No, it can be anything you want. HTML or text were just the
most obvious and easiest to implement examples.
Cheers,
NC |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Jan 09, 2009 5:24 am | All times are GMT
|
|
Loans | Hotels in Rome | Loans | Loans | Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|