Sending XML data using HTTP POST with PHP

you can use cURL library for posting data: http://www.php.net/curl $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL, “http://websiteURL”); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, “XML=”.$xmlcontent.”&password=”.$password.”&etc=etc”); $content=curl_exec($ch); where postfield contains XML you need to send – you will need to name the postfield the API service (Clickatell I guess) expects

Send JSON POST request with PHP

You can use CURL for this purpose see the example code: $url = “your url”; $content = json_encode(“your data to be sent”); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array(“Content-type: application/json”)); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $content); $json_response = curl_exec($curl); $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ( $status != 201 ) { … Read more

React Native – Axios – Trying to upload image

Can’t be sure but in my case I had to add a ‘name’ field to the file. Following other advices, I’ve end up with something like this: import axios from ‘axios’; import FormData from ‘form-data’; function upload (data, images, token) { const formData = new FormData(); formData.append(‘data’, data); images.forEach((image, i) => { formData.append(‘images’, { …image, … Read more

File updload in post form in VBS

You are trying to upload binary file content as base64 encoded text, so it’s necessary to specify the appropriate MIME header, here is the fixed snippet of your code: request = request & sBoundary & vbCrLf request = request & “Content-Disposition: form-data; name=file; filename=” & sFile & vbCrLf request = request & “Content-Type: application/x-object” & … Read more

How to perform an HTTP POST request in ASP?

You can try something like this: Set ServerXmlHttp = Server.CreateObject(“MSXML2.ServerXMLHTTP.6.0”) ServerXmlHttp.open “POST”, “http://www.example.com/page.asp” ServerXmlHttp.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded” ServerXmlHttp.setRequestHeader “Content-Length”, Len(PostData) ServerXmlHttp.send PostData If ServerXmlHttp.status = 200 Then TextResponse = ServerXmlHttp.responseText XMLResponse = ServerXmlHttp.responseXML StreamResponse = ServerXmlHttp.responseStream Else ‘ Handle missing response or other errors here End If Set ServerXmlHttp = Nothing where PostData is the data … Read more

Getting All $_POST From Multiple Select Value

I’ve found the answer… <select name=”cars[]” multiple=”multiple”> <option value=”volvo”>Volvo</option> <option value=”saab”>Saab</option> <option value=”opel”>Opel</option> <option value=”audi”>Audi</option> </select> and in the PHP part : $cars = $_POST[‘cars’]; print_r ($cars);