Webフォームを使用せずにPOSTデータを送信する方法はありますか?私は第三者支払い処理業者と協力しており、支払いを手動で提出するオプションがありますが、データはPOSTフォーマットにする必要があります。WebフォームのないPHP POSTデータ
スクリプトをCRONジョブとして実行する予定で、自動化されているため、Webフォームの送信によるユーザー入力はありません。
ありがとうございます。
Webフォームを使用せずにPOSTデータを送信する方法はありますか?私は第三者支払い処理業者と協力しており、支払いを手動で提出するオプションがありますが、データはPOSTフォーマットにする必要があります。WebフォームのないPHP POSTデータ
スクリプトをCRONジョブとして実行する予定で、自動化されているため、Webフォームの送信によるユーザー入力はありません。
ありがとうございます。
トライCURL
http://php.net/manual/en/book.curl.php
//set POST variables
$url = 'http://domain.com/get-post.php';
$fields = array(
'lname' => urlencode($last_name),
'fname' => urlencode($first_name),
'title' => urlencode($title),
'company' => urlencode($institution),
'age' => urlencode($age),
'email' => urlencode($email),
'phone' => urlencode($phone)
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
は、カスタムコンテキストとcURL拡張モジュール、あるいはfile_get_contents()
を使用することができます。
cURL http://php.net/manual/en/book.curl.php – cmorrissey
あなたはGuzzleを使用できます:http://guzzlephp.org/ – m4t1t0