is there another way to do this HTTP request in php?

ivn

New Member
\[code\]function do_post_request($url, $data, $optional_headers = null) { $request = new HttpRequest($url, HttpRequest::METH_POST); $request->setBody($data); $response = $request->send(); return $response->getBody();}\[/code\]This piece of code doesn't seem to be working, and seems to crash my script. I don't know if its because I don't have the php_http module, but is there an equivalent I can use?For instance curl? I have tried curl, but I don't know much about it, and with curl I got a "bad request" returned from the server I was trying to connect to with a 400 status.Anything would be goodThanksTomEdit:\[code\]function do_post_request($url, $data, $optional_headers = null) { $request = new HttpRequest($url, HttpRequest::METH_POST); $request->setBody($data); $response = $request->send(); return $response->getBody();}echo "before";$response = do_post_request($url, $data);echo "After";\[/code\]Doing that makes "before" appear on the page. But no "After".After managing to turn error reporting on I get this:\[code\]Fatal error: Class 'HttpRequest' not found in /home/sites/ollysmithwineapp.com/public_html/mellowpages/geocode.php on line 25\[/code\]So I need another way to do the HTTP Request.
 
Back
Top