onion2k wrote:You can't. As far as the browser is concerned the # means "Ok, the address and variables stop here, the rest is just so I can find a location".
The strange is, that this code works, both from the other server, and if i write the URL myself:
Code: Select all
<?php
$text = $_GET['text'];
mail("my@email.com", "Mobil Test", $text, "From: noreply@tkjweb.dk\nX-Mailer: http://$HTTP_HOST$REQUEST_URI");
?>
But this only works if i write the URL and make the anchor as %23:
Code: Select all
<?php
$string = urlencode($_GET['text']);
$string = substr(urldecode($string), 1);
list($init, $cmd, $rest) = split(" ", $string);
if ($init == "PSP" && $cmd == "number") {
$numbertoget = $rest;
error_reporting(E_ALL);
$request = 'http://www.tkjweb.dk/get_phoneowner.php?number='.urlencode($numbertoget);
// Make the request
$return = file_get_contents($request);
// Retrieve HTTP status code
list($version,$status_code,$msg) = explode(' ',$http_response_header[0], 3);
// Check the HTTP Status code
switch($status_code) {
case 200:
// Success
break;
case 503:
die('Error 503. That means: Service unavailable. An internal problem prevented us from returning data to you.');
break;
case 403:
die('Error 403. That means: Forbidden. You do not have permission to access this resource, or are over your rate limit.');
break;
case 400:
// You may want to fall through here and read the specific XML error
die('Error 400. That means: Bad request. The parameters passed to the service did not match as expected. The exact error is returned in the XML response.');
break;
default:
die('The call returned an unexpected HTTP status of:' . $status_code);
}
list($name, $adress, $city) = split("<br>", $return);
$message = "The Number: ".$numbertoget."\n\nName: ".$name."\nAdress: ".$adress."\nCity: ".$city;
mail("my@email.com", "Phone Number Lookup", $message, "From: noreply@tkjweb.dk\nX-Mailer: http://tkjweb.dk");
}
?>
I've also changed the http://$HTTP_HOST$REQUEST_URI in the other script to
http://tkjweb.dk, as it said that the $REQUEST_URI was an undefined variable!
Please check my code and see if you can find some mistakes, and figure out why the first one is working, while the other isn't!