Buy Now
Sign in

Web service REST and chronoforms implementation

johnli , August 27 at 19:21
J
johnli
Hello,​
​I have a website and I wish the connected to the web service that a friend has developed using Laravel.​
​The problem is that I am not a good developer, and my challenge for now is to be able to consume the address his_domain / API / service he spun me.​
​I did research and I saw some articles that deal with the subject but nothing concrete. However, I chose the method I saw here on this forum.​
​Here is à part of code that I add in the custom code of my form but I have no results.
<?php​
​ # An HTTP GET request example​
​ $url = 'http://192.168.100.34/mobility-v2_dev2/public/api/service';​
​ $ch = curl_init($url);​
​ curl_setopt($ch, CURLOPT_TIMEOUT, 5);​
​ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);​
​ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);​
​ $data = curl_exec($ch);​
​ curl_close($ch);​
​ echo $data;​
​ ?>
An idea of what needs to be changed?
Thank in advance
healyhatman
The url, unless your friend is running the web server on your computer. Also try
print_r($data);
instead of echo to check for data. If you have the "return as var" option selected, things won't actually echo but will be stored in the var, so make sure that's not checked.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
J
johnli
print_r($data);
is not work.
If you have the "return as var" option selected
Please, how can I do to check "return as var" option selected?
I inspected the code of the page and the PHP part is in comment. (see images)​
​​
​Is this normal?
1.JPG
2.JPG
Attachments
1.JPG
1.JPG
(41.81 KiB)
44 Downloads/Views
2.JPG
2.JPG
(70.19 KiB)
42 Downloads/Views
1.JPG
1.JPG
(41.81 KiB)
44 Downloads/Views
2.JPG
2.JPG
(70.19 KiB)
44 Downloads/Views
2.JPG
2.JPG
(70.19 KiB)
55 Downloads/Views
1.JPG
1.JPG
(41.81 KiB)
42 Downloads/Views
healyhatman
OK sorry I thought you were in CF6, ignore my "return as var" comment.
I'm not familiar with CF5 but clearly your PHP code is in the wrong spot since it's just being put in your form as a html comment - no, it's not normal.
You'll have to read the manual or FAQs or wait for Bob or someone else to help you sorry, don't know anything about CF5.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman