Here is a curl solution.
 
Create a function in your config.php file. In my example the function is 
called 
function  BOLTFjacGetExternalPage($args)
 
Then in the page where you want to display a page use the functio markup
[(jacGetExternalPage url=http://www.mydomian.com/somepage)]
 
Here is the function I used in config.php.  I am not expert, you may make 
better or easier function!
// =================================
// The Boltwire Stuff
 function  BOLTFjacGetExternalPage($args) {
  $url = false;
  if(isset($args['url'])) $url = $args['url'];
  if ($url == false){
   return("No URL SPECIFIED");
  }
  /* 
    Should use a cache here somehow. Otherwise you may hit the url to 
frequently!
    If someone can do that...show me....  
  */
  
  $filecontents = jac_file_get_contents($url);
  /*
   modify content here or escape content, or add wrappers, etc...
  */
  return $filecontents;
 }
// ==================================== 
// The CURL STUFF
// some servers php function file_get contents works fine and some you need 
CURL.
// This function selects which method to use.
 function jac_file_get_contents($url)
 {
  if (function_exists('curl_exec')) {
    $CURLAVAILABLE = TRUE;
   } else {
      $CURLAVAILABLE = FALSE;
  }
  
  if(!$CURLAVAILABLE)
  { 
   $file_contents = file_get_contents($url);
  }
  else
  {
   $ch = curl_init();
   $timeout = 16; // set to zero for no timeout
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   
   //MAY NEED THIS, BUT CAUSES PROBLEMS??
   @curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE);
   curl_setopt ($ch, CURLOPT_MAXREDIRS, 3);
   //curl_setopt ($ch, CURLOPT_VERBOSE, TRUE);
   //curl_setopt ($ch, CURLOPT_AUTOREFERER, TRUE);
   
   $file_contents = curl_exec($ch);
   curl_close($ch);
  }
  return $file_contents;
 }
// =================================

 

-- 
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to