I accessed a page through a mock request a.php
Want to implement the function of Automatic request B page in a.php page
Want to ask the automatic request function code How to implement?
Reply to discussion (solution)
View the Curl function
View the Curl function
I am a novice php, can be detailed point? Thanks, man.
/** * Post method gets data * @param string $url destination URL * @param array $dataes the data to post * @param int $timeout The maximum time to wait for a response defaults to 1 * @re Turn $output If the host is available, return the appropriate return if it is not valid return false */static function post ($url, $dataes, $timeout =1) {$ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url) curl_setopt ($ch, curlopt_returntransfer,1);//Specify Data transfer support Postcurl_setopt ($ch, curlopt_post,1);//Set the key value of POST pass to curl_setopt ($ch, Curlopt_postfields, $dataes);//Set timeout curl_setopt ($ch, Curlopt_ TIMEOUT, $timeout), $output =curl_exec ($ch); Curl_close ($ch); return $output;}
It seems to be able to use, return information!!