Tuesday, March 29, 2011

Get all the top google search results | Google Search Results API |

We will be using the google ajax api in this script. As you might have found, by default it gives out only 4 results. Or you may manage to get 8 with one more parameter. But here, with some tweaks, you will get the top 64 results! (And 64 is the upper limit, because google doesn’t like bots.)

<?php
function google_search_api($args, $referer = 'http://localhost/testing/', $endpoint = 'web')
{
 
if ( !array_key_exists('v', $args) )
$args['v'] = '1.0';
//$args['key']="ABQIAAAArMTuM-CBxyWL0PYBLc7SuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxT-uD75NXlWUsDRBw-8aVAlQ29oCg";
//$args['userip']=$_SERVER['REMOTE_ADDR'];
$args['rsz']='8';
$url .= '?'.http_build_query($args, '', '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// note that the referer *must* be set
curl_setopt($ch, CURLOPT_REFERER, $referer);
$body = curl_exec($ch);
curl_close($ch);
//decode and return the response
return json_decode($body,true);
}
$query=urldecode(isset($_GET['q'])?$_GET['q']:"none");
echo "Results for: $query<br />-----<br />";
$res = google_search_api(array('q' => $query));
$pages=$res['responseData']['cursor']['pages'];
$nres=0;
for($i=0;$i<count($pages);$i++)
{
$res = google_search_api(array('q' => $query,'start'=>$rez['responseData']['cursor']['pages'][$i]['start']));
for($j=0;$j<count($res['responseData']['results']); $j++)
{
$nres++;
echo urldecode($res['responseData']['results'][$j]['url'])."<br />";
}
}
echo "<br />---<br />Total number of reuslts: $nres";
?>
 
 

Wednesday, March 23, 2011

plimus payment gateway | payment gateway | Sample code to integrate plimus payment gateway

 Here is a Sample code to integrate plimus as payment gateway either for one time payment or for Recurring payment.

<form id="form1" action="https://sandbox.plimus.com/jsp/buynow.jsp" method="post">
<div>
<input type="hidden" name="contractId" value="2114108" />
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="overridePrice" value="20" />
<input type="hidden" name="custom1" value="1001" />
<input type="hidden" name="enableCustom" value="Y" />
<input type="hidden" name="firstName" value="Lakhan" />
<input type="hidden" name="lastName" value="Pal" />
<input type="hidden" name="email" value="lakhangarg@gmail.com" />
<input type="hidden" name="address1" value="6252 NW 65 Terrace" />
<input type="hidden" name="address2" value="Test Course" />
<input type="hidden" name="city" value="Parkland" />
<input type="hidden" name="zipCode" value="33067" />
<input type="hidden" name="country" value="us" />
<input type="hidden" name="state" value="FL" />
<input type="hidden" name="workPhone" value="1-858-350-7473" />
<input type="hidden" name="cardNumber" value="4111111111111111" />
<input type="hidden" name="verifyCardCode" value="411" />
<input type="hidden" name="bCur" value="USD" />
<input type="hidden" name="currency" value="USD" />
<input type="submit" id="btnSubmit" name="btnSubmit" value="Plimus - Pay Now"/>
</div>
</form>



 Refer the following useful urls:

plimus sandbox URL  :https://sandbox.plimus.com/jsp/buynow.jsp

Form for plimus: http://www.dotnetspark.com/kb/841-payment-gateway-integrate---plimus.aspx

httpNotificationVariable IPN variables: https://sandbox.plimus.com/html/httpNotificationVariable.html

Useful tip for IPN:

http://home.plimus.com/ecommerce/learning-center/instant-notifications/ipn-guide
http://home.plimus.com/ecommerce/learning-center/instant-notifications/sample-code