How you guys solved HTTPRequest in development time. In development time i push run button on SB toolbar and code will be run on 127.0.0.1:9080. In this case i cant use HTTPRequest, because other address that 127.0.0.1:9080 will be cross domain and 127.0.0.1:9080 used by SB server? I need to communicate with php script.
Sorry, if my english is not clear enouhgt
SB and HTTPRequest
- SparrowhawkMMU
- Posts: 281
- Joined: Wed Aug 19, 2015 3:02 pm
- Location: United Kingdom
Re: SB and HTTPRequest
Hi Karu,
At the server end, you need to send an allow origin header. for example, in PHP, you need to include this with your response:
The * means any origin, ie any client anywhere - you can filter it to specific IP addresses if these are known and fixed.
Further reading: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
At the server end, you need to send an allow origin header. for example, in PHP, you need to include this with your response:
Code: Select all
header('Access-Control-Allow-Origin: *');
Further reading: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Re: SB and HTTPRequest
thanks but somehow i didnt understand, can you give me example please, thanksSparrowhawkMMU wrote:Hi Karu,
At the server end, you need to send an allow origin header. for example, in PHP, you need to include this with your response:
The * means any origin, ie any client anywhere - you can filter it to specific IP addresses if these are known and fixed.Code: Select all
header('Access-Control-Allow-Origin: *');
Further reading: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Re: SB and HTTPRequest
Now i succeed, thanks:
<?php
header("Access-Control-Allow-Origin: *");
?>
text to return
<?php
header("Access-Control-Allow-Origin: *");
?>
text to return