私はphpが初めてで、いくつかのデータをURLに送信し、サーバーからの応答を書きたいと思っています。何を試しても応答は空です コードは次のとおりです
$post_data['userid'] = "demo";
$post_data['password'] = "demo";
$post_data['to'] = "$to";
$post_data['message'] = iconv("UTF-8","Windows-1253","$text");
$post_data['from'] = 'sender';
//traverse array and prepare data for posting (key1=value1)
foreach ( $post_data as $key => $value) {
$post_items[] = $key . '=' . $value;
}
//create the final string to be posted using implode()
$post_string = implode ('&', $post_items);
//create cURL connection
$curl_connection = curl_init('http://www.lexiconsoftware.gr/sms/warrior.asp');
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curld, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curld, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($curld, CURLOPT_COOKIEFILE, 'cookie.txt');
//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
//perform our request
$result = curl_exec($curl_connection);
//show information regarding the request
//print_r(curl_getinfo($curl_connection));
//echo curl_errno($curl_connection) . '-' . curl_error($curl_connection);
$getresult = curl_get_contents($result);
echo $getresult;
$http_data = curl_exec($curld);
$curl_info = curl_getinfo($curld);
$headers = substr($http_data, 0, $curl_info['header_size']); //split out header
echo "Message Status: $http_data, headers: $headers<br><a href=\"smser.php\">Send New</a>";
//close the connection
curl_close($curl_connection);
コードはデータを送信しますが、空のページだけで応答はありません