English 中文(简体)
如何接收由档案发送的数值——对象——功能?
原标题:How to receive values which are sent by file_get_contents() function?
  • 时间:2011-02-04 08:15:30
  •  标签:
  • php
  • function

I sent values through file_get_contents.
My question is i am unable receive(print) GET method values in work.php.
I am using stream_context_create() this will create a resource id.

page name sendvalues.php

// Create a stream
$opts = array(
   http =>array(
     method =>"GET",
     phone  => "9848509317",
     msg    => "hi naveen"
  )
);

echo $context = stream_context_create($opts);

$file = file_get_contents( http://www.aakrutisolutions.com/projects/testingsite/smstest/sms_http_curl/work.php , false, $context);
echo $file;

page name work.php
echo "
";
print_r($_GET);  /// i am unable to get my query string values
echo "
";
问题回答

仅附上你在座标上的ur:

$file = file_get_contents( http://www.aakrutisolutions.com/projects/testingsite/smstest/sms_http_curl/work.php?phone=123&msg=hi%20naveen );

The context options you used... are context options. Here is specified which you can user for http: http://www.php.net/manual/de/context.http.php It s not to be transmitted if you put random stuff in there.

Your array is incorrect. Look at the examples at http://php.net/manual/en/function.file-get-contents.php. You cannot simply add POST arguments to the context array.

提出《长期合作行动倡议》要求的正确背景阵列就是这样:

$opts = array(
   http  => array(
     method  =>  POST ,
     content  => http_build_query(array(
       phone  => 9848509317,
       msg    =>  hi naveen 
    ))
  )
);

www.un.org/Depts/DGACM/index_spanish.htm 或者简单地使用GET(如你在其他文字中期望的那样),这样就可以在URL中提出论点(与)。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签