For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2006 > How can I do this in PHP









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How can I do this in PHP
tony

2006-07-27, 7:56 am

Good Day,

I have a CGI script that I want to convert to PHP (it has to post variables
in the "http headers" to another server that runs a cgi script.

The cgi script that does the posting (which I want to convert to php) is as
follows:
require LWP;

$addy = "http://10.10.10.10/xys/xyzname/register.cgi";

$ua = new LWP::UserAgent;

my $header = HTTP::Headers->new('IDNUM'=>'1234567890123','ACCNUM'=>'123');

my $request = HTTP::Request->new('POST',"$addy",$header);

$request->content("$xml");

$response = $ua->request($request);

$reply_msg = $response->content;

print "||$addy||\n";

print "||$reply_msg||\n";



Hope somebody can help out ;-)


Dennis de Wit

2006-07-27, 7:56 am

tony wrote:
> Good Day,
>
> I have a CGI script that I want to convert to PHP (it has to post variables
> in the "http headers" to another server that runs a cgi script.
>
> The cgi script that does the posting (which I want to convert to php) is as
> follows:
> require LWP;
>
> $addy = "http://10.10.10.10/xys/xyzname/register.cgi";
>
> $ua = new LWP::UserAgent;
>
> my $header = HTTP::Headers->new('IDNUM'=>'1234567890123','ACCNUM'=>'123');
>
> my $request = HTTP::Request->new('POST',"$addy",$header);
>
> $request->content("$xml");
>
> $response = $ua->request($request);
>
> $reply_msg = $response->content;
>
> print "||$addy||\n";
>
> print "||$reply_msg||\n";
>
>
>
> Hope somebody can help out ;-)


Mhhh... I have tried this before. I didn't find a good sollution to
this, other than writing a socket application that opens a connection to
that other site.

You can try these functions: http://nl2.php.net/manual/en/ref.http.php

good luck.

Dennis
Sawi

2006-07-27, 7:56 am

Dennis de Wit napisał(a):
> Mhhh... I have tried this before. I didn't find a good sollution to
> this, other than writing a socket application that opens a connection to
> that other site.


Mhhh... Don't You think that cURL isn't enough ? :)
http://pl2.php.net/manual/pl/ref.curl.php

--
Pozdrawiam,
Sawi
www.fruitysite.net
Dennis de Wit

2006-07-27, 6:56 pm

Sawi wrote:
> Dennis de Wit napisał(a):
>
> Mhhh... Don't You think that cURL isn't enough ? :)
> http://pl2.php.net/manual/pl/ref.curl.php
>


Sorry... i was on a windows server :-O You're right... curl should do
the trick. I never thought of that

Dennis
Sawi

2006-07-28, 3:57 am

Dennis de Wit napisał(a):

> Sorry... i was on a windows server :-O You're right... curl should do
> the trick. I never thought of that


cURL is also available on a windows server. It's very useful tool :)

--
Pozdrawiam,
Sawi
www.fruitysite.net
Dennis de Wit

2006-07-28, 3:57 am

Sawi wrote:
> Dennis de Wit napisał(a):
>
>
> cURL is also available on a windows server. It's very useful tool :)
>


Wokey... I'll look into that. I didn't know that. But still; my web
hosting provider must have it installed to enable me to use it.

Anyway... Does Tony have a sollution to his problem yet?

Dennis
Sawi

2006-07-28, 3:57 am

Dennis de Wit napisał(a):

> Wokey... I'll look into that. I didn't know that. But still; my web
> hosting provider must have it installed to enable me to use it.


This extension is very rarely disabled :)

> Anyway... Does Tony have a sollution to his problem yet?


Should have - we gave him two ways of it.

--
Pozdrawiam,
Sawi
www.fruitysite.net
Dennis de Wit

2006-07-28, 3:57 am

Sawi wrote:
> Dennis de Wit napisał(a):
>
>
> This extension is very rarely disabled :)
>
>
> Should have - we gave him two ways of it.
>


Pffff... I just dont want to use it ok? :-P I'll keep looking for
reasons not to use it :)

I'm going back to work :)

Dennis
tony

2006-07-28, 6:57 pm

Hello.

I will give curl a shot and see how it goes!
"Sawi" <sawi4@lpteno.atzc.op> wrote in message
news:eacgrr$djo$1@news.onet.pl...
> Dennis de Wit napisal(a):
>
>
> This extension is very rarely disabled :)
>
>
> Should have - we gave him two ways of it.
>
> --
> Pozdrawiam,
> Sawi
> www.fruitysite.net



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com