By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

PHP equivalent to XMLHtttpRequest functions

P: n/a
Is there a PHP equivalent to the JavaScript XMLHttpRequest function:
.......
myrequest.open('POST', url, true);
........
myrequest.send(data);

In other words, I'd like to get data from another web page that needs to
receive input via the POST method.

Thanks,
Edward Hass
Dec 30 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Edward Hass wrote:
Is there a PHP equivalent to the JavaScript XMLHttpRequest function:
......
myrequest.open('POST', url, true);
.......
myrequest.send(data);

In other words, I'd like to get data from another web page that needs to
receive input via the POST method.

Thanks,
Edward Hass
Check out the cURL functions.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Dec 30 '07 #2

P: n/a
Hello,

on 12/30/2007 08:09 PM Edward Hass said the following:
Is there a PHP equivalent to the JavaScript XMLHttpRequest function:
......
myrequest.open('POST', url, true);
.......
myrequest.send(data);

In other words, I'd like to get data from another web page that needs to
receive input via the POST method.
You may want to take a look at this popular HTTP client class:

http://www.phpclasses.org/httpclient
--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Dec 31 '07 #3

P: n/a
"Edward Hass" <ne*******@magiciandb.comwrote in message
news:2GUdj.606$yv5.235@trndny07...
Is there a PHP equivalent to the JavaScript XMLHttpRequest function:
......
myrequest.open('POST', url, true);
.......
myrequest.send(data);

In other words, I'd like to get data from another web page that needs to
receive input via the POST method.

Thanks,
Edward Hass
Thanks guys. . .I tried curl, and it worked fine - except that NY State
blocks people from using the site unless they enter through their own
portal.

Public servants anyone???

Regards,
Edward Hass
Jan 1 '08 #4

P: n/a
Edward Hass wrote:
"Edward Hass" <ne*******@magiciandb.comwrote in message
news:2GUdj.606$yv5.235@trndny07...
>Is there a PHP equivalent to the JavaScript XMLHttpRequest function:
......
myrequest.open('POST', url, true);
.......
myrequest.send(data);

In other words, I'd like to get data from another web page that needs to
receive input via the POST method.

Thanks,
Edward Hass
Thanks guys. . .I tried curl, and it worked fine - except that NY State
blocks people from using the site unless they enter through their own
portal.

Public servants anyone???

Regards,
Edward Hass
Well, it's harder, but you could use cURL to enter through their portal.
The biggest problem would be if they require javascript.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 2 '08 #5

P: n/a
..oO(Edward Hass)
>Thanks guys. . .I tried curl, and it worked fine - except that NY State
blocks people from using the site unless they enter through their own
portal.
Blocking in what way? Do you receive an error message from the server?
Can you post the URL of the page that you want to access directly?

Maybe they're just checking the HTTP referrer, which is easy to fake if
a stupid server script should rely on it.

Micha
Jan 2 '08 #6

P: n/a
Guys, I dunno what this exchange is all about. Like PHP is a server-
land programming language, and XMLHttpRequest is a client-land
function, which communicates client-to-server. Which you guys all
know very well.

It appears to me that the premise of the basic question is faulty, and
we oughtta ask Edward Hass to explain his question better. (Mebbe the
rest of you have figgered it out, but I sure ain't.)

AS

Jan 2 '08 #7

P: n/a
ashore wrote:
Guys, I dunno what this exchange is all about. Like PHP is a server-
land programming language, and XMLHttpRequest is a client-land
function, which communicates client-to-server. Which you guys all
know very well.

It appears to me that the premise of the basic question is faulty, and
we oughtta ask Edward Hass to explain his question better. (Mebbe the
rest of you have figgered it out, but I sure ain't.)

AS

Yep, but PHP can still fetch pages (including with POST data) and
process them on the server end (or pass them back to the browser). I do
it for a few sites, like PayPal.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 2 '08 #8

P: n/a
..oO(ashore)
>Guys, I dunno what this exchange is all about. Like PHP is a server-
land programming language, and XMLHttpRequest is a client-land
function, which communicates client-to-server. Which you guys all
know very well.
Sure.
>It appears to me that the premise of the basic question is faulty, and
we oughtta ask Edward Hass to explain his question better. (Mebbe the
rest of you have figgered it out, but I sure ain't.)
IMHO the explanation was pretty clear:

| In other words, I'd like to get data from another web page that needs
| to receive input via the POST method.

If you want to do it from the client, you can use the XMLHttpRequest
object if available, from the server there's cURL and some other ways.
But the action performed is pretty much the same in both cases.

Micha
Jan 2 '08 #9

P: n/a
On Wed, 02 Jan 2008 02:30:49 +0100, ashore <sh*****@gmail.comwrote:
Guys, I dunno what this exchange is all about. Like PHP is a server-
land programming language, and XMLHttpRequest is a client-land
function, which communicates client-to-server. Which you guys all
know very well.

It appears to me that the premise of the basic question is faulty, and
we oughtta ask Edward Hass to explain his question better. (Mebbe the
rest of you have figgered it out, but I sure ain't.)
I only have Edward Hass's quote to go on, as I don't see the original
post. From that, to me his 'in other words' was quite clear, and clearly
something cURL could handle. The fact that an XMLHTTPRequest is the
default way in javascript of getting information from another URL has
little to do with it as far as I can tell. I grant you that I assume the
OP knows PHP only works on the server, not the client.
--
Rik Wasmus
Jan 2 '08 #10

P: n/a
Rik Wasmus wrote:
On Wed, 02 Jan 2008 02:30:49 +0100, ashore <sh*****@gmail.comwrote:
>Guys, I dunno what this exchange is all about. Like PHP is a server-
land programming language, and XMLHttpRequest is a client-land
function, which communicates client-to-server. Which you guys all
know very well.

It appears to me that the premise of the basic question is faulty, and
we oughtta ask Edward Hass to explain his question better. (Mebbe the
rest of you have figgered it out, but I sure ain't.)

I only have Edward Hass's quote to go on, as I don't see the original
post. From that, to me his 'in other words' was quite clear, and clearly
something cURL could handle. The fact that an XMLHTTPRequest is the
default way in javascript of getting information from another URL has
little to do with it as far as I can tell. I grant you that I assume the
OP knows PHP only works on the server, not the client.
Actually, XMLHTTPRequest has its own problems - like it can't get data
from a site other than the one it was loaded from. Unfortunately, IE6
and below don't enforce this restriction, but Firefox does.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jan 2 '08 #11

This discussion thread is closed

Replies have been disabled for this discussion.