Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. function postPage($url, $pvars, $referer, $timeout){
  2. if(!isset($timeout))
  3. $timeout=30;
  4. $curl = curl_init();
  5. $post = http_build_query($pvars);
  6. if(isset($referer)){
  7. curl_setopt ($curl, CURLOPT_REFERER, $referer);
  8. }
  9. curl_setopt ($curl, CURLOPT_URL, $url);
  10. curl_setopt ($curl, CURLOPT_TIMEOUT, $timeout);
  11. curl_setopt ($curl, CURLOPT_USERAGENT, sprintf("Mozilla/%d.0",rand(4,5)));
  12. curl_setopt ($curl, CURLOPT_HEADER, 0);
  13. curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
  14. curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
  15. curl_setopt ($curl, CURLOPT_POST, 1);
  16. curl_setopt ($curl, CURLOPT_POSTFIELDS, $post);
  17. curl_setopt ($curl, CURLOPT_HTTPHEADER,
  18. array("Content-type: application/x-www-form-urlencoded"));
  19. $html = curl_exec ($curl);
  20. curl_close ($curl);
  21. return $html;
  22. }
  23. $vars = array(
  24. 'vehicleNo' => 'SFT4228H',
  25. 'transferDate' => '10042014'
  26. );
  27.  
  28. $result = postPage('test.php', $vars, 'https://vrl.lta.gov.sg/lta/vrl/action/pubfunc?ID=EnquireTransferFee', '30');
  29.  
  30. print "Result:".$result; //Show data in my website
  31.  
  32. $result = postPage('https://vrl.lta.gov.sg/lta/vrl/action/pubfunc?ID=EnquireTransferFee', $vars, 'test.php', '30');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement