Home > Backend Development > PHP Tutorial > How to post data inside php program, php program post data_PHP tutorial

How to post data inside php program, php program post data_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:58:46
Original
957 people have browsed it

How to post data within the PHP program, PHP program post data

The example in this article describes the method of posting data inside the PHP program. Share it with everyone for your reference. The specific implementation method is as follows:

$postData = array();
$postData['data1'] = "testdata1";
$postData['data2'] = "testdata2";
$postData['data3'] = "testdata3";
$url='http://yourdomain/do.php';
$str="";
foreach ($postData as $k=>$v)
{
  $str.= "$k=".urlencode($v)."&";
}
$postData=substr($str,0,-1);
$c = curl_init();
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_URL,$url);
curl_setopt($c, CURLOPT_POSTFIELDS, $postData);
$result = curl_exec($c);
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/976697.htmlTechArticleHow to post data inside the php program, PHP program post data This article describes the method of posting data inside the php program. Share it with everyone for your reference. The specific implementation method is as follows: $pos...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template