PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Zoom and ssi

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Zoom and ssi

    Your site clearly explains how to use server side includes. A minor problem with the suggested php/apache approach, using the *virtual* command, is that it is not possible to catch the output from *virtual* - it goes straight to the browser.

    Do you have any idea whether the IIS solution you suggest, using shell_exec, will also work with apache - I know I could just test it, but thought it best to ask first.

    Thanks

  • #2
    I haven't tried it myself, but I believe it should be possible. You would need to use the exec() function.

    There's a couple of user posted methods on the PHP webpage for virtual() as well, which supposedly does what you're after. Here's one such example:

    Code:
    [FONT=Courier New]// preparing the arguments passed to this PHP page [/FONT]
    [FONT=Courier New]$QSTRING = $QUERY_STRING; [/FONT]
     
    [FONT=Courier New]// pay attention to the maximum length of the QUERY string. [/FONT]
    [FONT=Courier New]while (list ($header, $value) = each ($HTTP_POST_VARS)){ [/FONT]
    [FONT=Courier New]if (empty($QSTRING)) [/FONT]
    [FONT=Courier New] $QSTRING = $header.'='.$value; [/FONT]
    [FONT=Courier New]else [/FONT]
    [FONT=Courier New] $QSTRING = $QSTRING.'&'.$header.'='.$value; [/FONT]
    [FONT=Courier New]} [/FONT]
     
    [FONT=Courier New]putenv('REQUEST_METHOD=GET'); [/FONT]
    [FONT=Courier New]putenv('QUERY_STRING='.$QSTRING); [/FONT]
     
    [FONT=Courier New]unset($return_array); [/FONT]
    [FONT=Courier New]exec('my_CGI', $return_array, $return_val); [/FONT]
    Replace 'my_CGI' with the search.cgi from Zoom. You may need to specify an absolute path here such as "/htdocs/www/cgi-bin/search.cgi" or "C:\\Progra~1\\Apache~1\\Apache2\\cgi-bin\\search.cgi".

    Hope that helps!
    Last edited by Ray; Sep-27-2007, 12:32 AM.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      Another approach to SSI + PHP

      Another approach that works well is to use the cURL library built into php to fetch the zoom cgi page from the current server on http://127.0.0.1

      PHP Code:
      $dozoom   "http://127.0.0.1/path to zoom/search.cgi";

      $doquery  =  "zoom_query=" $zoom_query;
      $doquery .= "&zoom_page=" $zoom_page;
      $doquery .= "&zoom_per_page=" $zoom_per_page;
      $doquery .= "&zoom_cat%5B%5D=" $zoom_cat;
      $doquery .= "&zoom_and=" $zoom_and;
      $doquery .= "&zoom_sort=" $zoom_sort;

      $ch = @curl_init();
      @
      curl_setopt($chCURLOPT_URL$dozoom);
      @
      curl_setopt($chCURLOPT_POST1);
      @
      curl_setopt($chCURLOPT_POSTFIELDS$doquery);
      @
      curl_setopt($chCURLOPT_TIMEOUT30);
      @
      curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
      @
      curl_setopt($chCURLOPT_HEADERfalse);
      @
      curl_setopt($chCURLOPT_NOBODYfalse);
      $search = @curl_exec($ch);
      $error = @curl_error($ch);
      @
      curl_close($ch); 

      Comment

      Working...
      X