Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. function httpPost($url,$params)
  2. {
  3. $postData = '';
  4. //create name value pairs seperated by &
  5. foreach($params as $k => $v)
  6. {
  7. $postData .= $k . '='.$v.'&';
  8. }
  9. rtrim($postData, '&');
  10.  
  11. $ch = curl_init();
  12.  
  13. curl_setopt($ch,CURLOPT_URL,$url);
  14. curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  15. curl_setopt($ch,CURLOPT_HEADER, false);
  16. curl_setopt($ch, CURLOPT_POST, count($postData));
  17. curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
  18.  
  19. $output=curl_exec($ch);
  20.  
  21. curl_close($ch);
  22. return $output;
  23.  
  24. }
  25.  
  26.  
  27. $params = array(
  28.  
  29. 'action' => 'UserCreate',
  30.  
  31. 'cityCombo' => '1'
  32.  
  33. );
  34.  
  35. httpPost("http://www.site.com/reg.php",$params);
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement