Dear all experts,
I am currently coding a small script to put data to other website by "curl" this web site cgi script.
OK, now let me introduce some backgrounds.
The PHP variable of the url of the CGI script on that site is:
$url = "http://www.example.com/index.cgi?";
Original CGI on that example.com site read the form data data_a and data_b in <input type=text> and <input type=textarea> by POST method.
Two data I need to fill to this CGI script by my PHP script are:
$data_a = "Title One";
$data_b = "
<table border=0 width=100%>
<tr>
<td>
<b>
<font size=2>
ABC
</font>
</b>
</td>
</tr>
</table>
";
The $data_a is clear text only, while $data_b is HTML code.
I wrote the script in:
===================================
$url = "http://www.example.com/index.cgi?";
$data_a = "Title One";
$data_b = "
<table border=0 width=100%>
<tr>
<td>
<b>
<font size=2>
ABC
</font>
</b>
</td>
</tr>
</table>
";
$result = /usr/bin/curl -d "data_a=$data_a&data_b=$data_b" '$url';
echo $result;
===================================
The result of the above script show nothing after execution.
But after I modified to:
===================================
$url = "http://www.example.com/index.cgi?";
$data_a = "Title One";
$data_b = "ABC";
$result = /usr/bin/curl -d "data_a=$data_a&data_b=$data_b" '$url';
echo $result;
===================================
The result of my PHP script shoe properly (i.e. same as shown on posting data on example.co), I started to guess is it the problem of mutli-line of $data_b , so I change my previous script from multi-line $data_b to single line $data_b, as following:
===================================
$url = "http://www.example.com/index.cgi?";
$data_a = "Title One";
$data_b = "<table border=0 width=100%><tr><td><b><font size=2>ABC</font></b></td></tr></table>";
$result = /usr/bin/curl -d "data_a=$data_a&data_b=$data_b" '$url';
echo $result;
===================================
But the result show nothing again, I hope experts in this forum can give me some advise, your great help is highly appreciated!!
Cheers,
KK Yuen