Reading remote pages via HTTP by sending a POST request

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Patricia Saura
Forum Newbie
Posts: 3
Joined: Tue May 13, 2003 12:33 pm

Reading remote pages via HTTP by sending a POST request

Post by Patricia Saura »

Hi@all!

I am looking for a solution to the following:
For posting automatically in a forum I have to send information via a POST request to that forum. But I don't know how to do this. I have just recently tested reading a remote location without this POST stuff. (fopen, fgets, fclose)
Do you know any way to do this?
And maybe, you even know a way to fetch the cookie sent by the forum, so I could login with my regular ID and would not have to post anonymously...

Thanx a lot.
Greeting.
Patricia
Jim
Forum Contributor
Posts: 238
Joined: Fri Apr 19, 2002 5:26 am
Location: Near Austin, Texas

Post by Jim »

If I understand your problem, using $_POST['information_you_want']; should work.

To read a cookie as a username, this should do:

$username = $_COOKIE['cookie_name'];

I may be misunderstanding your question though.
Patricia Saura
Forum Newbie
Posts: 3
Joined: Tue May 13, 2003 12:33 pm

Post by Patricia Saura »

Yes, I think you are misunderstanding my question.

I'm not sending any POST-Info to my own script. There is a forum outside my server. Just like this one here. And I need to access this forum through my own PHP script. But therefore I need to send information to the forum (always from within PHP) just like a browser would, if I told him to "method=post" something to the forum.

Only, I do not want to add posts manually cause I'm starting to run a virtual company in a virtual nation dealing with bets. And these bets have to be communicated somehow. Well, as i'm not going to spam anyone, I thought of automatically posting my actions in the forum. (Besides, my free server doesn't support sendmail yet.) But unfortunately, I'm no admin of the forum server. :-) So it gets kind of problematic. At least for me. Therefore, I tried my luck in this forum. (Because, if you dont know anything...)

I hope my question got a bit more clear now.
It's the same with that cookie thing: Of course I have an account in the forum. It would be a bit more professional to post using that account. Because it appears slightly different from anonymous posts. :-) But it is not really necessary.
Necessary it (cookie thing) is for automatically transfer the won amounts of virtual money. And in the nearer future I really would like to handle this by a script too. Because it will get kind of annoying work to always transfer this by hand... :-)

Greetings.
Patricia
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Patricia Saura
Forum Newbie
Posts: 3
Joined: Tue May 13, 2003 12:33 pm

Great! Thanks

Post by Patricia Saura »

That was exactly what I needed...
Thanks a lot.

Greeting.
Patricia
Post Reply