Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <?php //exit;
  2. echo $url = 'http://www.galaxyreportage.com/cron/prexposting.php';
  3.  
  4. $ch = curl_init();
  5.  
  6. if($ch === false)
  7. {
  8. die('Failed to create curl object');
  9. }
  10.  
  11. curl_setopt ($ch, CURLOPT_URL, $url);
  12. curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
  13. curl_setopt ($ch, CURLOPT_POST, true);
  14.  
  15. $data = array(
  16. 'title'=>'Test',
  17. 'slug'=> 'test',
  18. 'content'=> 'Content',
  19. 'cat_id'=>'1',
  20. 'publish_date'=>'2019-01-16 00:00:00',
  21. 'link'=>'',
  22. 'content_index'=>1
  23. );
  24.  
  25. // The submitted form data, encoded as query-string-style name-value pairs
  26. //$post_data = 'name=Harry&age=25';
  27. curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
  28. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
  29. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  30. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  31. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  32. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  33. $httpCode = curl_getinfo($ch , CURLINFO_HTTP_CODE); // this results 0 every time
  34. $output = curl_exec($ch);
  35. if ($output === false) $output = curl_error($ch);
  36. echo stripslashes($output);
  37. curl_close ($ch);
  38.  
  39. //echo $output;
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement