Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #!/bin/bash
  2. url='https://monetizemore.api-us1.com';
  3. api_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
  4. ch=curl_init();
  5. curl_setopt($ch, CURLOPT_URL, $url."/api/3/contacts");
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  7. curl_setopt($ch, CURLOPT_HTTPHEADER, array("Api-Token: ".$api_key));
  8. curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  9. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  10. $output=curl_exec($ch);
  11. curl_close($ch);
  12. $result=json_decode($output, true);
  13. echo "result meta total: <br />" . $result["meta"]["total"] . "<br />";
  14. echo "The entire result printed out:<br />";
  15. echo "<pre>";
  16. print_r($result);
  17. echo "</pre>";
  18. echo "API Call:<br />".$url."/api/3/contacts";
  19.  
  20. ERROR:
  21. $cd backupscripts/
  22. $ ls
  23. sample.sh
  24. $ ./sample.sh
  25. ./sample.sh: line 4: syntax error near unexpected token `('
  26. ./sample.sh: line 4: `ch=curl_init();'
  27.  
  28.  
  29. ./sample.sh: line 4: syntax error near unexpected token `('
  30. ./sample.sh: line 4: `ch=curl_init();'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement