开发者

Submit PHP form in OpenSocial gadget

开发者 https://www.devze.com 2023-01-25 03:21 出处:网络
I\'m trying to implement an OpenSocial gadget for iGoogle. I\'m writing my application in PHP and then \"wrapping\" it in an opensocial container using the XML gadget specification.

I'm trying to implement an OpenSocial gadget for iGoogle. I'm writing my application in PHP and then "wrapping" it in an opensocial container using the XML gadget specification.

If I run my PHP in a stand-alone page it works fine, in an iGoogle container when I press the button on the form it says "The web page could not be found".

What am I doing wrong here? Is this the right way to go if I want to implement my gadget using PHP, is this even possible?

The XML gadget description:

<?xml version="1.0" encoding="UTF-8"?>
<Module>
    <ModulePrefs title="Register interest 29">
        <Require feature="opensocial-0.8"/>
        <Require feature="views" />
        <Preload href="http://opensocial-resources.googlecode.com/svn/samples/tutorial/tags/api-0.8/gifts.json" />
    </ModulePrefs>
    <Content type="html" href="http://myserver.com/OpenSocialSamples/test7.php">
    </Content>
</Module>

And I have the test7.php file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Random DBpedia reader example</title>
    </head>

    <body>
        <form action="test7.php" method=post">
            Search: <input type=text name="searchString"><br>
            <input type=submit value="Get data" >
        </form>

        <br><br>
        <h3> Data Test: </h3>
        <?php
            if ($_GET['searchString']) {
                echo $_GET['searchStri开发者_运维百科ng'];
            }
        ?>
    </body>
</html>


I found that it works properly if use Content type="url" instead of "http"


Use the full path to test7.php in the form action.

0

精彩评论

暂无评论...
验证码 换一张
取 消