Guest User

Untitled

a guest
Jul 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $ch = curl_init();
  2. curl_setopt($ch, CURLOPT_URL, $api_root);
  3. curl_setopt($ch, CURLOPT_POST, true);
  4. curl_setopt($ch, CURLOPT_POSTFIELDS, "xml"); // tried http_build_query also
  5. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Added this, still no good
  6. return curl_exec($ch); // returns false
  7.  
  8. $curl = "curl -X POST -d 'xml' {$api_root}";
  9. return `$curl`; // returns expected xml from server
  10.  
  11. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  12.  
  13. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  14.  
  15. $curl = "curl -X POST -d 'xml' {$api_root}";
  16. return `$curl`; // returns expected xml from server
  17.  
  18. // Thanks to all the answers
  19. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  20.  
  21. // This appears to default false on CLI, true in libcurl
  22. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Add Comment
Please, Sign In to add comment