?
Solved

header location

Posted on 2006-06-02
6
Medium Priority
?
264 Views
Last Modified: 2010-04-01
Hello,
I would like to convert this into c/c++

<?php
header("Location: " . $_GET['link']);
die();
?>

can someone help me? thanks
0
Comment
Question by:aplelois
6 Comments
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16814328
>> header("Location: " . $_GET['link']);
>> die();
What exactly they do ?
0
 

Author Comment

by:aplelois
ID: 16814419
Lets say the name is (goto.c) and when its compiled is (goto.cgi)
so if im at index.html and I make a links I want to use them this way
<a href="cgi-bin/goto.cgi?link=http://www.google.com">Google</a>
<a href="cgi-bin/goto.cgi?link=http://www.yahoo.com">Yahoo</a>
the 1 links goes directly to google the 2 goes to yahoo
the php script does that
0
 

Author Comment

by:aplelois
ID: 16814484
I dont want this, intead of google I want the site
that is in here (goto.cgi?link=http://mysite.com)

#include <stdio.h>
int main()
{

   printf("Location:http://www.google.com\n\n");
   exit(0);
}
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Expert Comment

by:MechanTOurS
ID: 16814864
i may suggest you to use a library like libCGI : http://libcgi.sourceforge.net/

about a fast solution to ur problem:

http://www.jmarshall.com/easy/cgi/hello.c.txt

it can get big fast.
0
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 16817102
CGI applications receive these values as environment variables. Just use

#include <stdio.h>
int main()
{

   printf("Location:%s\n\n", getenv("QUERY_STRING"));
   exit(0);
}

and it will print

link=http://mysite.com

See also http://hoohoo.ncsa.uiuc.edu/cgi/env.html ("CGI Environment Variables")
0
 

Author Comment

by:aplelois
ID: 16819888
yes, jkr that is what I was looking for. thanks
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question