LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 09-06-2005, 06:08 AM   #1
nyk
Member
 
Registered: Jan 2004
Location: Berne, Switzerland
Distribution: FC4, Gentoo
Posts: 112

Rep: Reputation: 15
Redirects in Zope (ZMS)


I'm doing a new version of a homepage in ZMS, a content managment system for zope.
But I have also some perl CGI applications that I'd like to integrate into the new webpage.
I used to integrate them into a php menu system in the old homepage. I was using a function like the one below to redirect all get/post requests to the perl CGI application, upon a certain trigger string in a request.
Is something like this also possible in zope? And if yes, how? Thanks for any help!

This is the old request redirect function for php:
Code:
function post_upload($url) {
        $up=parse_url($url);if(!isset($up["port"])) {$up["port"]=80;}
        $boundary=md5(mt_rand());$data="--$boundary\r\n";
        $_REQUEST["ip"]=find_ip();
        foreach($_REQUEST as $key=>$value) {
                if (!is_array($value)) { // arrays contain files
                        if ($makLF1) {$data.="\r\n";}
                        $data.="Content-Disposition: form-data; ";
                        $data.="name=\"$key\"\r\n\r\n";
                        $data.="$value\r\n--$boundary";$makLF1++;
                }
        }
        foreach($_FILES as $key=>$value) {
                $fn=basename($_FILES[$key]['name']);$ufn="tmp/".$fn;
                move_uploaded_file($_FILES[$key]['tmp_name'],$ufn);
                $h=fopen($ufn,"r");$bindat=fread($h,filesize($ufn));
                fclose($h);
                if (($makLF1) and (!$makLF2)) {$data.="\r\n";}
                if ($makLF2) {$data.="\r\n";}
                $data.="Content-Disposition: form-data; ";
                $data.="name=\"$key\"; filename=\"$fn\"";
                $data.="\r\n\r\n$bindat\r\n--$boundary";$makLF2++;
        }
        $data.="--\r\n\r\n";$lenga=strlen($data);
        $msg ="POST ".$up["path"]." HTTP/1.0\r\n";
        $msg.="Content-Type: multipart/form-data; ";
        $msg.="boundary=$boundary\r\n";
        $msg.="Connection: close\r\n";
        $msg.="Content-Length: $lenga\r\n\r\n";
        $f=fsockopen($up["host"],$up["port"]);fputs($f,$msg.$data);
        while(!feof($f)) {
            $buf=fgets($f,128);
            if ($ok) {$result.=$buf;}
            if (preg_match("/^Content-Type/",$buf)) {$ok=1;}
        }
        fclose($f);return $result;
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
virtual host redirects with mod_rewrite sqn Linux - Software 1 10-11-2005 09:47 PM
Trouble installing ZMS (Zope) nyk Linux - Software 1 09-03-2005 08:59 AM
Distro for the 'cafe. Redirects, logins, etc. darknova2k Linux - Distributions 3 03-22-2005 08:05 PM
Apache redirects?! How rincewind Linux - Software 3 02-23-2005 03:43 PM
ICS and 302 redirects don't mix dataangel Linux - Networking 1 08-22-2004 03:36 PM


All times are GMT -5. The time now is 01:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration