php new bie Posted July 16, 2010 Share Posted July 16, 2010 hello, I write a script using http_post_fields , the script work on my local host using easyphp .. When I upload it to my host service , it gives me an error to undefined function http_post_fields .. OK I know the problem ! the pecl_http extension not installed , So I contact my service provider and there is no replay .. my Q : any alternative function or code similar to http_post_fields thanks Link to comment https://forums.phpfreaks.com/topic/207957-http_post_fields-problem/ Share on other sites More sharing options...
kenrbnsn Posted July 16, 2010 Share Posted July 16, 2010 Please post your script between tags. Ken Link to comment https://forums.phpfreaks.com/topic/207957-http_post_fields-problem/#findComment-1087132 Share on other sites More sharing options...
AbraCadaver Posted July 16, 2010 Share Posted July 16, 2010 function http_post_lite($url, $data, $headers=null) { $data = http_build_query($data); $opts = array('http' => array('method' => 'POST', 'content' => $data)); if($headers) { $opts['http']['header'] = $headers; } $st = stream_context_create($opts); $fp = fopen($url, 'rb', false, $st); if(!$fp) { return false; } return stream_get_contents($fp); } Link to comment https://forums.phpfreaks.com/topic/207957-http_post_fields-problem/#findComment-1087170 Share on other sites More sharing options...
php new bie Posted July 16, 2010 Author Share Posted July 16, 2010 AbraCadaver , it works , Thank you very very much Link to comment https://forums.phpfreaks.com/topic/207957-http_post_fields-problem/#findComment-1087172 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.