Send an XML post request to a web server with CURL

白昼怎懂夜的黑 提交于 2019-11-29 09:15:34

Try it this way:

  $url = 'https://android.googleapis.com/gcm/send';
  $ch = curl_init();
  curl_setopt( $ch, CURLOPT_URL, $url );
  curl_setopt( $ch, CURLOPT_POST, true );
  curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
  curl_setopt( $ch, CURLOPT_POSTFIELDS, "<xml>here</xml>" );
  $result = curl_exec($ch);
  curl_close($ch);

For more details visit: http://php.net/manual/en/function.curl-setopt.php

I think using the HTTP classes may be better suited for making HTTP requests.

See http://www.php.net/manual/intro.http.php .

Also, there are specific WMS libraries for PHP, e.g. http://docs.huihoo.com/geoserver/1.6.0/Parsing%20and%20using%20WMS%20capabilities%20with%20PHP.html .

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!