facebook twitter hatena line email

「Php/curl/xml送信」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「 $xmltag = <<< EOD <?xml version="1.0" encoding="UTF-8"?> <root><id>2</id><name>taro</name></root> EOD; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl...」)
 
 
行5: 行5:
 
  $ch = curl_init();
 
  $ch = curl_init();
 
  curl_setopt($ch, CURLOPT_URL, $url);
 
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HTTPHEADER,     array('Content-Type: text/xml'));
+
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
 
  curl_setopt($ch, CURLOPT_POST, true);
 
  curl_setopt($ch, CURLOPT_POST, true);
 
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmltag);
 
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmltag);

2017年11月30日 (木) 16:52時点における最新版

$xmltag = <<< EOD
<?xml version="1.0" encoding="UTF-8"?>
<root><id>2</id><name>taro</name></root>
EOD;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmltag);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);