|  | Posted by Tom on 06/07/06 16:48 
<tony@tony.com> wrote in message news:MPG.1ef0bd3b934f949c9898c5@news-text.blueyonder.co.uk...
 >
 > Is it possible to use the post method to send a form from PHP without
 > having to put the form in a html page?
 
 Unless I've failed to understand what you're after, you could use the CURL
 library.
 It allows you to call any web page (not necessarily a PHP page) from within
 your PHP.
 Make sure the "extension=php_curl.dll" is uncommented in your PHP.ini.
 
 Something like this (which uses buffering to stop the returned web page
 being displayed)...
 ob_start();
 $ch = curl_init('https://www.mysite.com/cgi/incoming.php');
 curl_setopt( $ch, CURLOPT_POST, true );
 curl_setopt( $ch, CURLOPT_POSTFIELDS, 'data01=12&data02=rejected');
 curl_exec($ch);
 $getinfo_results = curl_getinfo($ch);
 curl_close( $ch );
 $return_page = ob_get_contents();
 ob_end_clean();
 
 "$getinfo_results" will give an array of information telling you if the page
 request was successful or not, and "$return_page" will contain the full HTML
 of the request.
 
 Tom
 [Back to original message] |