2

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['searchString'];
            }
        ?>
    </body>
</html>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Lince81
  • 815
  • 5
  • 17
  • 30

2 Answers2

1

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

Rommy
  • 11
  • 1
0

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Bemmu
  • 17,849
  • 16
  • 76
  • 93
  • Well spotted! Is this the right way to go if I want to implement my gadget using PHP, is this even possible? – Lince81 Nov 15 '10 at 14:04
  • Personally I would write a small javascript client and talk to my server over gadgets.io.makeRequest. – Bemmu Nov 27 '10 at 04:59