What I have is a block with links to different posts on a forum (non-drupal forum). When a person clicks on a link normally going to here:

http://mysite.com/cgi-bin/tiger/index.cgi?read=234

I was thinking instead of having the link go here:
http://mysite.com/test/passedparameter=234

where 234 is a passed parameter to the page. I don't know if this is the correct syntax for the call (I'm guessing)...

then I would put this code in page "test":

http://tarty.schulerlab.com/cgi-bin/tiger/index.cgi?read=&passedparameter

where so that &passedparameter is the variable that reads in the passed parameter.

this would read in post 234 and display it on the drupal page "test".

what is the correct way to do this? can someone point me to some instructions for setting this up? I looked, but couldn't find any.

thanks

Comments

zbricoleur’s picture

So, you want to have a block on your Drupal site with a list of links. You want all these links to point to the same Drupal page, but each pass in a different parameter to that page. Then based on the passed parameter, you want the Drupal page to load a page (a forum post) from another website.

Is that what you are trying to do?

ikati’s picture

So, you want to have a block on your Drupal site with a list of links. You want all these links to point to the same Drupal page, but each pass in a different parameter to that page. Then based on the passed parameter, you want the Drupal page to load a page (a forum post) from another website.

Is that what you are trying to do?

yep.. except I have the forum on my website.
also, it is not drupal's forum. it is the archive of a perl forum on this site which I recently converted to drupal. I'm trying to incorporate the display of the posts on this forum into drupal, rather than having it open onto a separate page (which looks completely different than the rest of the site).

thanks.

Lynne

ikati’s picture

does anyone know how to do this, or can point me to the right documentation?

thanks.

Lynne

zbricoleur’s picture

If you are using Clean URLs, set the links up in the block like so:
www.example.com/page_alias?x=parameter
Then in the body of that page (page_alias), put your PHP code to retrieve and display the forum post. Use $_GET[x] to retrieve the parameter.

If you are not using Clean URLs, set up the links in the block like this:
www.example.com/?q=node/333/argument1
Then in the body of that page, put your PHP code to retrieve and display the forum post. Use arg(2) to retrieve the parameter.

ikati’s picture

thank you so much for replying.

however, I must still be doing something wrong.

I created a page with the clean URL: av

this is what I put in the page:

<div class="avbb"><?php
      $ch = curl_init();
      $timeout = 0; // set to zero for no timeout
      curl_setopt ($ch, CURLOPT_URL, 'http://www.mysite.com/cgi-bin/av/config.pl?read=$_GET[x]');
      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
      $file_contents = curl_exec($ch);
      curl_close($ch);
      echo $file_contents;
      ?></div>

this displays the index page fine. but.. when I put this in the URL:

http://www.mysite.com/av?read=234

instead of displaying Post#234, I get the index again. It is like it isn't passing the parameter in $_GET[x].

what am I doing wrong? also.. I don't know much about PHP, so.. I probably am doing something wrong that would be obvious to people versed in php. so. please have patience and spell it out for me, as I am still php dummie. :)

Lynne

zbricoleur’s picture

In PHP, $_GET is an array. Whatever is in the square brackets is the index of the array. Also, using variables inside quotes only works for double quotes, otherwise you have to use the concatenation operator. So...
Try changing this:

curl_setopt ($ch, CURLOPT_URL, 'http://www.mysite.com/cgi-bin/av/config.pl?read=$_GET[x]');

To this:

curl_setopt ($ch, CURLOPT_URL, "http://www.mysite.com/cgi-bin/av/config.pl?read=$_GET['read']");
ikati’s picture

thank you for your help. I tried it, but now I'm getting this error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/eviltwin/public_html/includes/common.inc(1537) : eval()'d code on line 5

this is the code I have in the page:

<div class="avbb">
<?php
      $ch = curl_init();
      $timeout = 0; // set to zero for no timeout
      curl_setopt ($ch, CURLOPT_URL, "http://www.mysite.com/cgi-bin/av/config.pl?read=$_GET['read']");
      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
      $file_contents = curl_exec($ch);
      curl_close($ch);
      echo $file_contents;
      ?>
</div>

??

Lynne

zbricoleur’s picture

I think I goofed. Try this instead (2 lines instead of 1):

$par = $_GET['read'];
curl_setopt ($ch, CURLOPT_URL, "http://www.mysite.com/cgi-bin/av/config.pl?read=$par");
ikati’s picture

that worked!

:)

Lynne