nxs_cURLTest

The NextScripts: Social Networks Auto-Poster nxs cURLTest function.

Description

nxs_cURLTest( $url, $msg, $testText ); 

Parameters (3)

0. $url
The url.
1. $msg
The msg.
2. $testtext
The testtext.

Usage

  1. if ( !function_exists( 'nxs_cURLTest' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/nxs_functions.php'; 
  3.  
  4. // The url. 
  5. $url = null; 
  6.  
  7. // The msg. 
  8. $msg = null; 
  9.  
  10. // The testtext. 
  11. $testtext = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = nxs_cURLTest($url, $msg, $testtext); 
  15.  

Defined (1)

The function is defined in the following location(s).

/nxs_functions.php  
  1. function nxs_cURLTest($url, $msg, $testText) { echo "<br/>--== Test Requested ... ".$url."<br/>"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url);  
  2. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.39 Safari/537.36");  
  3. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); 
  4. $response = curl_exec($ch); $errmsg = curl_error($ch); $cInfo = curl_getinfo($ch); curl_close($ch); echo "Testing ... ".$url." - ".$cInfo['url']."<br/>"; 
  5. if (stripos($response, $testText)!==false) echo "....".$msg." - OK<br/>"; else { echo "....<b style='color:red;'>".$msg." - Problem</b><br/>"; prr($response); prr($errmsg); prr($cInfo); echo nxs_cURLTestCode($url); }