Alternative to perl LWP in php

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
User avatar
coolpravin
Forum Newbie
Posts: 20
Joined: Mon May 19, 2003 12:56 am
Location: India

Alternative to perl LWP in php

Post by coolpravin »

Does anybody knows alternative to Perl's
LWP in php.
I want to convert
$ua = LWP::UserAgent->new;
$request = HTTP::Request->new(POST => $server);
$request->content($post);
$response = $ua->request($request);
$response = $response->content;

$response =~ /<status>([^<]+)<\/status>/;
my $ret = $1;
$ret = 0 if ($1 eq '00');
return $ret;
This code from cgi-perl to php
Does anybody know how?
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

You could use curl, but it requires curl compiled in with PHP, I use this all the time to post to various CC Gateways and XML services and such.. If you don't have it compiled in to PHP youc an still use it thru a shell and the command line tool, there are some other posts about this on the forum, search for curl..
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

and there's also http://snoopy.sf.net
a php class to emulate a browser requesting a new document.
Post Reply