0

i want to send parameters to url with GET method , i used file_get_content to do this. my code is :

$app_url = "http://localhost/index.php?number=%s&service_id=%s&shortcode=%s&msg=%s" ; 
$msg     = "Thank you for joining us! خوش آمدید";
$msg     = urlencode($msg);
$address = sprintf($app_url , $current_user,$service_id,$scode,$msg);
$ret     = file_get_contents($address);
echo $ret

it works , and dont have problem , but when my $msg is long, i get warning message and parameters don't send to url:

Warning: file_get_contents(http://localhost/send_sms/index.php?number=123&service_id=test&shortcode=123&msg=Thank+u%%%%s%21%0A%D%%%%%8%B4%D9%85%D8%A7+%%%%%%D8%A8%D8%A7+%D9%85%%%%D9%%%%88%D9%81%D9%8
Hedi
  • 322
  • 4
  • 17
  • 2
    Well yes, URLs *have* a practical limit. Is it really necessary for you to do an HTTP request to `localhost`? Is this really what you're going to use in production, or is this just a test? Couldn't you `include` the PHP file locally without needing to deal with URLs? – deceze Dec 09 '14 at 05:20
  • 1
    RE: [URLs have a practical limit](http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers) – sjagr Dec 09 '14 at 05:28
  • @deceze tnx for your solution, i changed my code :) – Hedi Dec 09 '14 at 05:32

0 Answers0