Quantcast
Channel: OutSystems Community
Viewing all articles
Browse latest Browse all 1476385

[Forums] Rest api instead of php curl

$
0
0
Hi Guys,

We want to send information from the OS platform to a client website.
The client provides us of a php file that we can use to send information to there server.
Only we want to send it from OS so where trying to find a whay of doing this.
The code that there providing us:

$ch = curl_init();
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_VERBOSE, 0);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_USERPWD, "{$this->username}:{$this->password}");
            curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
            curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
            curl_setopt($ch, CURLOPT_POST, true);
            
            $file = new CurlFile($this->pdffile);
            
            $post_array = array(
                "my_file"=> $file,
                "upload"=>"Upload", 
                "send"=>True
            );
            curl_setopt($ch, CURLOPT_URL,  $this->url);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array);
            $response = curl_exec($ch);

I was trying to use the REST API from OS adding the input parameter upload is not a problem only how to add the file?

Viewing all articles
Browse latest Browse all 1476385

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>