Jump to content

How could I link directly to a search result?


[-_-]

Recommended Posts

It sends searches from my main site to another torrent site in frames. So for example how would I link to the second result thru my website so it stays in frames here? http://www.plentyoftorrents.com/results_new.php?site=Mininova&q=ubuntu+linux

 

Results page:

<?php
// grab the search query and request site from the url

if($_POST["q"]){
$q = $_POST["q"];
}else{
$q = $_GET['q'];

}
$q = htmlentities(stripslashes(trim($q)));
if($_POST['site']){
$site = $_POST["site"];
}else{
$site = $_GET['site'];

}
include('switch.php');

?>

 

Switch.php

 

<?php
// here we use a switch statement to define our url
switch ($site) {


case "Mininova":

$url = "http://www.mininova.org/search/?search=". $q;

break;


case "Btjunkie":

$url = "http://btjunkie.org/search?q=". $q;

break;

case "Btleech":

$url = "http://btleech.com/search.php?q=". $q ."&cat=&min=min&max=max&submit=Torrents&adv=&br="; 


break;

 

Link to comment
Share on other sites

You will need to alter your HTML forms too so the "method" = get in order to use $_GET:

 

<form method="get" ......

 

Also I believe you can specify "target" in <form> as well, I'd look into that for loading the contents into a frame...

 

Adam

Link to comment
Share on other sites

Im testing it out here instead of the torrent form

http://plentyoftorrents.com/web/web2/results_new.php?q=coffee&site=Google

and I click on the first result which is wikipedia and nothing changes in the address bar.

I would like it to be something like this.

http://plentyoftorrents.com/web/web2/results_new.php?q=coffee&site=Google=http://en.wikipedia.org/wiki/Coffee

Or if theres a way of keeping the url shorter and still being able to link directly to a result in the frames that might be better.

Link to comment
Share on other sites

If you want to use only a pure GET method to transfer data (which you do for caching purpose) you have to push enough data through GET to "Get" what you want back.

 

 

You could use a database table to backend this and then passing a PK via GET restore what you need that way.

I would have no idea how to do that. Is there a name for this url in frames thing? maybe I can find a step by step tutorial.

Link to comment
Share on other sites

You  don't need a tutorial its very simple read what GET and POST do

 

 

You are trying to pass additional data beyond the destination page via a URL that is GET and those extra bits of data are what you are concerned about so figure out how you want to organize the extra bits of data and stick em in the url and your there

Link to comment
Share on other sites

You  don't need a tutorial its very simple read what GET and POST do

 

 

You are trying to pass additional data beyond the destination page via a URL that is GET and those extra bits of data are what you are concerned about so figure out how you want to organize the extra bits of data and stick em in the url and your there

GET and POST for HTML or PHP?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.