Archive for June, 2009

Flat Input box with CSS

input
{
border: 1px solid;
}

If you want to change the input box background do as follow:

input
{
border: 0px solid;
}

, , , ,

No Comments

SOAP PHP example

This article will show how to do web service using SOAP (Simple Object Access Protocol). You can use SOAP using your PHP. It is usually enabled by default. You can check whether you have SOAP in your phpinfo setting.

For the example we will be using this WSDL. You can see that it have the TopGoalScorers operation:

<operation name=”TopGoalScorers”>
<documentation>
Returns an array with the top N goal scorers and their current score. Pass 0 as TopN and you get them all.
</documentation>
<input message=”tns:TopGoalScorersSoapRequest”/>
<output message=”tns:TopGoalScorersSoapResponse”/>
</operation>

And the operation have the input message:

<message name=”TopGoalScorersSoapRequest”>
<part name=”parameters” element=”tns:TopGoalScorers”/>
</message>

The input operation have one parameter from the element “TopGoalScorers“. The parameter is iTopN which have int value.

<xs:element name=”TopGoalScorers”>
<xs:complexType>
<xs:sequence>
<xs:element name=”iTopN” type=”xs:int”/>
</xs:sequence>
</xs:complexType>
</xs:element>

The return value from the output message is ArrayOftTopGoalScorer:

<xs:element name=”TopGoalScorersResponse”>
<xs:complexType>
<xs:sequence>
<xs:element name=”TopGoalScorersResult” type=”tns:ArrayOftTopGoalScorer”/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:complexType name=”ArrayOftTopGoalScorer”>
<xs:sequence>
<xs:element name=”tTopGoalScorer” type=”tns:tTopGoalScorer” minOccurs=”0″ maxOccurs=”unbounded” nillable=”true”/>
</xs:sequence>
</xs:complexType>

The return element is tTopGoalScorer, have two value sName (string) and iGoals (int).

<xs:complexType name=”tTopGoalScorer”>
<xs:sequence>
<xs:element name=”sName” type=”xs:string”/>
<xs:element name=”iGoals” type=”xs:int”/>
</xs:sequence>
</xs:complexType>

So the code will be:

$client = new SoapClient(”http://euro2008.dataaccess.eu/footballpoolwebservice.wso?WSDL”);

$params = array(’iTopN’ => 3);

result = $client->TopGoalScorers($params);

print_r($result->TopGoalScorersResult);

, , , , , , , , , , , , , , , , , , , , , , ,

No Comments

Google maps code sample

This article is a sample for google maps. You just need to download the code here. In the example, I show Google Headquarters in Google Maps. But before you download, you need to sign up for Google Maps API here and get a key that you will use in the code. From the code that you have download, find the following code:

<script src=”http://maps.google.com/maps?file=api&amp;v=2&amp;key=change-this-to-your-google-api” type=”text/javascript”></script>

and change “change-this-to-your-google-api” to your key. If you have any problem just comment below.

, , , , , , , , , ,

No Comments

Stop and play MARQUEE

This code will do a up down marquee and when your mouse hover at it, it will stop. When your mouse leave the marquee it will resume.

Here’s the demo.

Download the code here.

, , , , ,

No Comments

Captcha Script

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) are of challenge-response test used in computing to ensure that the response is not generated by a computer. Because application are unable to solve the CAPTCHA, anyone providing a correct solution is assumed to be human. Here’s the sample.

Download here for the code.

, , , , , , ,

No Comments

Set cookie with php

Here’s the code to set and get cookie

<?php

//set cookie
setcookie(”Cookie1″, $value);
setcookie(”Cookie2″, $value, time()+3600);

//get cookie

echo $_COOKIE["Cookie2"];
?>

, , , , , , ,

No Comments

Paypal donation code

  • Login to your paypal account

  • Go to merchant services at the main menu
  • Go to “Donations” at the right of your screen
  • You can then set your buttons and you will have your code
  • You can put the code at your sidebar’s blog.

, , ,

No Comments