Self Improvement Articles Directory - Debt Consolidation - Debt Consolidation - Find jobs - Record Songs for free

PDA

View Full Version : connect to external php script??


Javver
Oct 8th 2007, 6:10 am
hello, im new to all of this

i have php embeded in html and saved as index.php, in html part of it i want to
connect to an external PHP script located in my friend's webspace i use the <script> tag

both doesnt work.
<script src="http://domain.com/filename.php"></script> and

<script type="text/javascript" src="http://domain.com/filename.php"></script>


i just want to simply output the result of that php script in the certain part of my site.

my php scripts are working, but this part im having prob. with

am i using the correct method?

GMROCKS
Oct 8th 2007, 6:18 am
your friend's page shoud be something like <script type="text/javascript">
document.write("HTML HERE");
</script>

Javver
Oct 8th 2007, 6:54 am
your friend's page shoud be something like <script type="text/javascript">
document.write("HTML HERE");
</script>

sorry this doesnt work

KatieK
Oct 8th 2007, 11:37 am
A PHP script is processed on the sever, whereas JavaScripts are processed inside the broswer, so they're really not compatible.

I think you're going to have to copy your friend's PHP file to your site, then include it via PHP. Your server will need to process that PHP.

Alternately, I suppose you could use an iframe on your page, and have the source of the iframe be the PHP file.

madura99
Oct 8th 2007, 9:45 pm
hello, im new to all of this

i have php embeded in html and saved as index.php, in html part of it i want to
connect to an external PHP script located in my friend's webspace i use the <script> tag

both doesnt work.
<script src="http://domain.com/filename.php"></script> and

<script type="text/javascript" src="http://domain.com/filename.php"></script>


i just want to simply output the result of that php script in the certain part of my site.

my php scripts are working, but this part im having prob. with

am i using the correct method?
Mmm yeah I have done this.

visit wwwDOTlankacarsaleDOTcom and view source

if you want to use dynamically created javascript using php server side scripting
you can use <script type="text/javascript" src="http://domain.com/filename.php"></script> without having any problems

but make sure to avoid <script type="text/javascript"></script> tag in the php file

if you can not modify your friend script as you want above, you have use your own script.

KatieK
Oct 9th 2007, 8:51 am
Madura,

Oh, I see. You're using PHP to generate the JavaScript array. I should have thought of that.

Javver, does this work out for you?