Advertisement
Guest User

NSS Curl 400 Issue

a guest
Sep 30th, 2014
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <?php
  2.  
  3. $t1 = 'https://alice.sni.velox.ch';
  4. $t2 = 'https://carol.sni.velox.ch';
  5.    
  6. function build_handle($url)
  7. {
  8.     $ch = curl_init();
  9.    
  10.     curl_setopt($ch, CURLOPT_ENCODING, "");
  11.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  12.     curl_setopt($ch, CURLOPT_POST, true);
  13.     curl_setopt($ch, CURLOPT_URL, $url);
  14.     curl_setopt($ch, CURLOPT_HEADER, true);
  15.     curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
  16.     curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
  17.    
  18.     return $ch;
  19. }
  20.  
  21. $alice = build_handle($t1);
  22. $response = curl_exec($alice);
  23. curl_close($alice);
  24. echo "\n------------- Alice: -----------\n";
  25. echo "$t1\n";
  26. echo substr($response, 0, strpos($response, "\r\n\r\n"));
  27.  
  28. $carol = build_handle($t2);
  29. $response = curl_exec($carol);
  30. curl_close($carol);
  31. echo "\n------------- Carol: -----------\n";
  32. echo "$t2\n";
  33. echo substr($response, 0, strpos($response, "\r\n\r\n"));
  34.  
  35.  
  36. $carol = build_handle($t2);
  37. $response = curl_exec($carol);
  38. curl_close($carol);
  39. echo "\n------------- Carol 2: -----------\n";
  40. echo "$t2\n";
  41. echo substr($response, 0, strpos($response, "\r\n\r\n"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement