LOLWesta, a social media forum


You are not connected. Please login or register

View previous topic View next topic Go down Message [Page 1 of 1]

1
Load PHP data to your forum Empty Load PHP data to your forum Sun Sep 28, 2014 1:24 am

LOLWesta


LOLWesta King
Well, guess what's my tutorial now? It's load PHP data to your forum. You can use it with CORS, or AJAX. I prefer ajax 'cause that's the simplest way.

Ok, so imagine that you want to create userdatas and store it into database. First, you create a server. I recommend you use 000webhost. Then, open your forum and open JavaScript Management.

Then you create some AJAX. You do something like :

Code:
$(function() { $.get("yourphpscript.php", function( data ) {
console.log( data );
});

Then you set header on your PHP :

Code:
header(Access-Control-Allow-Origin) : *
your php code.. continue working with php code

If there's an error origin on your console then set the header value; if *, then change it into yourforum.forumotion.com.

That's it!

https://lolwesta.forumotion.com

2
Load PHP data to your forum Empty Re: Load PHP data to your forum Mon Dec 22, 2014 2:01 pm

sugar


Members
Members
wrong syntax ?

correct one :

Code:
header(Access-Allow-Control-Origin: *);

you can either do this :

Code:
if($_SERVER['HTTP_ORIGIN'] == "somewebsite.com") {
header(Access-Allow-Control-Origin: "somewebsite.com");
}
else
{
header("HTTP/1.1 403 Access Forbidden");
echo("403 Forbidden");
}

Smile

3
Load PHP data to your forum Empty Re: Load PHP data to your forum Sat Jan 17, 2015 11:48 am

Left


Members
Members
Don't forget this : if you'll make some script.php with mySQL needs, you have to connect the database to the script. Wink With something like.. uh, include('data.sql'); --- that's as far as I'm learning. But that will make the page load more slowly, if that's not a problem at all for you.

Sponsored content


View previous topic View next topic Back to top Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum