Pagina 1 van 1

Beveiligd link open in php maar niet in browser

Geplaatst: 19 apr 2006, 21:11
door sukkelaap
Hoe is het mogelijk om in PHP een link te laten open, zonder dat deze in de browser opent?

Dus er moet alleen een link aangeroepen worden, maar dit moet zo beveiligd zijn dat mensen nooit achter die link mogen komen.

Ik heb eerst dit script ergens uit een script kunnen plukken:

Code: Selecteer alles

$host = 'www.bepaaldewebsite.nl';
$path = '/map/';
$data = 'test=1&page=index&u=53';
$fp = @fsockopen($host,80);
			if ($fp) {
				@fputs($fp, "POST $path HTTP/1.0\n");
				@fputs($fp, "Host: $host\n");
				@fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
				@fputs($fp, "Content-length: " . strlen($data) . "\n");
				@fputs($fp, "Connection: close\n\n");
				@fputs($fp, $data);
				while (!feof($fp))
				$buf .= fgets($fp,128);
				fclose($fp);
			}
Op deze manier, maar als ik de gegevens naar mijn website aanpas werkt het alsnog niet. Is hier een oplossing voor?

Geplaatst: 23 apr 2006, 08:16
door sukkelaap
Ik heb wel dit volgende script gevonden:

Code: Selecteer alles

$param[username] = "user"; //this is the username of our TM4B account 
$param[pwd] = "wachtwoord"; //this is the password of our TM4B account 
$param[msg] = $_POST['bericht']; //this is the message that we want to send 
$param[to] = $nummer; //these are the recipients of the message 
$param[from] = $_POST['afzender'];//this is our sender if 
$param[affid] = "ID";//we want to send the message via first class 
$param[type] = "text";//we are only simulating a broadcast 
$param[test] = "1";//1=testmode 
                 
foreach($param as $key=>$val) //traverse through each member of the param array 
{ 
   $request.= $key."=".urlencode($val); //we have to urlencode the values 
   $request.= "&"; //append the ampersand (&) sign after each paramter/value pair 
} 
$request = substr($request, 0, strlen($request)-1); //remove the final ampersand (&) sign from the request             
                
$url = "http://www.neotel.nl/gateway/sms_mt.php"; //although we have used https, you can also use http 
$ch = curl_init(); //initialize curl handle 
curl_setopt($ch, CURLOPT_URL, $url); //set the url 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //return as a variable 
curl_setopt($ch, CURLOPT_POST, 1); //set POST method 
curl_setopt($ch, CURLOPT_POSTFIELDS, $request); //set the POST variables 
$returnc = curl_exec($ch); //run the whole process and return the response 
curl_close($ch); //close the curl handle      
$returnc = trim($returnc); 
Het probleem is alleen dat er telkens 2 smsjes worden verzonden terwijl dat niet gebeurd als ik de link in mijn gewone browser open. Dus ik denk dat dit script 2 keer draait. Weet iemand waardoor dit komt?