Advertisement
Guest User

Untitled

a guest
Sep 26th, 2013
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. $url = "https://www.xxx.xxx";
  2. $post = "";# all data that going to send
  3.  
  4. $ch = curl_init();
  5. curl_setopt($ch, CURLOPT_URL, $url);
  6. curl_setopt($ch, CURLOPT_POST, true);
  7. curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  8. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  9.  
  10. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  11. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  12. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0');
  13.  
  14. $exe = curl_exec($ch);
  15. $getInfo = curl_getinfo($ch);
  16.  
  17. if ($exe === false) {
  18. $output = "Error in sending";
  19. if (curl_error($ch)){
  20. $output .= "n". curl_error($ch);
  21. }
  22. } else if($getInfo['http_code'] != 777){
  23. $output = "No data returned. Error: " . $getInfo['http_code'];
  24. if (curl_error($ch)){
  25. $output .= "n". curl_error($ch);
  26. }
  27. }
  28.  
  29. curl_close($ch);
  30.  
  31. echo $output;
  32.  
  33. $url = "https://www.xxx.xxx";
  34. $post = "";# all data that going to send
  35.  
  36. $ch = curl_init();
  37. curl_setopt($ch, CURLOPT_URL, $url);
  38. curl_setopt($ch, CURLOPT_POST, true);
  39. curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  40. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  41.  
  42. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  43. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  44. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0');
  45.  
  46. $exe = curl_exec($ch);
  47. $getInfo = curl_getinfo($ch);
  48.  
  49. if ($exe === false) {
  50. $output = "Error in sending";
  51. if (curl_error($ch)){
  52. $output .= "n". curl_error($ch);
  53. }
  54. } else if($geInfo['http_code'] != 777){ //here $geInfo should be $getInfo
  55. $output = "No data returned. Error: " . $geInfo['http_code'];//as preline
  56. if (curl_error($ch)){
  57. $output .= "n". curl_error($ch);
  58. }
  59. }
  60.  
  61. curl_close($c); //$c should be $ch
  62.  
  63. echo $output;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement