FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to call external php script from html?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to call external php script from html? [message #172988 is a reply to message #172971] Mon, 14 March 2011 23:21 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 3/14/2011 4:39 AM, Erwin Moller wrote:
> On 3/11/2011 10:24 PM, astral wrote:
>>
>> "Erwin Moller"
>> <Since_humans_read_this_I_am_spammed_too_much(at)spamyourself(dot)com> wrote in
>> message news:4d7a54f7$0$81478$e4fe514c(at)news(dot)xs4all(dot)nl...
>>> On 3/11/2011 5:15 PM, astral wrote:
>>>>
>>>> "Erwin Moller"
>>>> <Since_humans_read_this_I_am_spammed_too_much(at)spamyourself(dot)com>
>>>> wrote in
>>>> message news:4d7a4734$0$41102$e4fe514c(at)news(dot)xs4all(dot)nl...
>>>> > On 3/11/2011 4:35 PM, Doug Miller wrote:
>>>> >> In article<ilddn7$uie$1(at)news(dot)eternal-september(dot)org>,
>>>> >> "astral"<astral(at)news(dot)eternal-september(dot)org> wrote:
>>>> >>
>>>> >>> I use cURL php script to extract html content from remote site and
>>>> >>> display
>>>> >>> it on my html page, so need execute this php script from my html
>> page.
>>>> >>
>>>> >> So in other words, you're asking us to help you violate someone
>>>> >> else's
>>>> >> copyright, by stealing his site content and presenting it as your
>>>> >> own.
>>>> >>
>>>> >> Bugger off.
>>>> >
>>>> > Well Dough, we don't know that, or do we?
>>>> > Personally, I am not against "stealing" content at all, assuming the
>>>> > OP gives credit to the real source.
>>>> > (And many authors are happy to be quoted/referenced/etc).
>>>> >
>>>> > But just in case you are right, I await the OP's response.
>>>> >
>>>> > Regards,
>>>> > Erwin Moller
>>>> >
>>>> > --
>>>> > "That which can be asserted without evidence, can be dismissed without
>>>> > evidence."
>>>> > -- Christopher Hitchens
>>>> --------------------------
>>>>
>>>> This *allowed* by resource owner, just to promote their products and
>>>> service, no any problems at all. Consider it as RSS feed, if you
>>>> like(almost same).
>>>
>>>
>>> Works for me. :-)
>>>
>>> And I don't feel like policing other people anyway.
>>>
>>> Here is an example using JavaScript.
>>> I would advise you to add some anti-caching approach like adding the
>>> number of milliseconds since Unix Epoch (I added that in my example).
>>>
>>> So try something like this:
>>>
>>> <script type="text/javascript">
>>> var myPHPScript = "http://www.example.com/myScript.php";
>>> var milliSecSinceUE = (new Date()).getTime();
>>> var myFakeImage = new Image();
>>> myFakeImage.src = myFakeImage+"?nocache="+milliSecSinceUE;
>>> </script>
>>>
>>> In case your PHPscript had data in the URL already, eg:
>>> http://www.example.com/myScript.php?article=34
>>>
>>> You must change the ? in a&.
>>> Also, I am polluting the global namespace with all the vars, some maybe
>>> it's better to put it in a function if you care.
>>>
>>> Regards,
>>> Erwin Moller
>>>
>> -------------------
>>
>> Thank you for the help, Erwin. I tried script, but it not working for me.
>> Server log show info that "File not found":
>>
>> File not found [/hsphere/local/home/domain/domain.com/eng/4ar/[object
>> HTMLImageElement]]
>>
>> Hosting support said that this error definitely related to my javascript.
>>
>> Thanks,
>> astral
>>
>
> Hi Astral,
>
> That is because my code was not tested. ;-)
>
> He is a better version:
>
> <script type="text/javascript">
> var myPHPScript = "http://www.example.com/myScript.php";
> var milliSecSinceUE = (new Date()).getTime();
> var myFakeImage = new Image();
> myFakeImage.src = myPHPScript +"?nocache="+milliSecSinceUE;
> </script>
>
> (The last line was wrong.)
>
> Hope that works for you.
>
> Regards,
> Erwin Moller
>
>

Which is still not calling a PHP file from an html file - rather is is
using javascript (which may be disabled) to try to do something which
can more easily (and reliably) be done other ways.

Such as changing the Apache configuration to redirect the .html file to
a .php file and processing the .php file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Lookup zip by IP address
Next Topic: browser url with #...
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 07:08:29 GMT 2024

Total time taken to generate the page: 0.04506 seconds