Jump to content

Search the Community

Showing results for tags 'google api'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. hi , I wrote this code with C # And 50 of Google's search results will show c# code GwebSearchClient client = new GwebSearchClient("WWW.blogfa.com"); IList<IWebResult> results = client.Search(" Test ", 50); // foreach (IWebResult result in results) { listBox1.Items.Add(result.VisibleUrl); } The PHP code is the same as C # code ,But why only 4 examples displays? What changes should I do in the PHP code? php code <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php /** * google_search_api() * Query Google AJAX Search API * * @param array $args URL arguments. For most endpoints only "q" (query) is required. * @param string $referer Referer to use in the HTTP header (must be valid). * @param string $endpoint API endpoint. Defaults to 'web' (web search). * @return object or NULL on failure */ function google_search_api($args, $referer = 'http://localhost/test/', $endpoint = 'web'){ $url = "http://ajax.googleapis.com/ajax/services/search/".$endpoint; if ( !array_key_exists('v', $args) ) $args['v'] = '1.0'; $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); } $rez = google_search_api(array( 'q' => 'Test', )); //results[$x]->url; print_r($rez); ?>
  2. Hello, I have written a code to use google map drawing tools to draw polygon, circle and point on the googlemap, i need to capture and store these drawing in my postgresql database and also be able to display the store data back on the map when queried. I need someone to look at my code and tell me how I can achieve this. The google map and the drawings functions well, i know i need to create a table in the database to capture the geometric information of the drawings which i have also done. but the table doesnt seem to be populating. i believe something is wrong with my code and i need help from anyone who has successfully done this in the past Thanks <?php $host = "host=localhost"; $port = "port=5432"; $dbname = "dbname=LS"; $credentials = "user=postgres password=carol74"; $db = pg_connect( "$host $port $dbname $credentials" ); if(!$db){ echo "Error : Unable to open database\n"; } else { echo "Opened database successfully\n"; } ?> <!DOCTYPE html> <head> <title>LSInfo Recording tool</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <style> html, body, #map { height: 90%; margin: 10px; padding: 0px } </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&libraries=drawing,geometry"></script> <script> var coordinates = []; var all_shapes = []; var selectedShape; function draw_shape() { for(var i = 0; i < all_shapes.length; i++) { all_shapes[i].setMap(null); } for(var i = 0; i < all_shapes.length; i++) { all_shapes[i].setMap(map); } } function clearSelection() { if(selectedShape) { selectedShape.setEditable(false); selectedShape = null; } } function setSelection(shape) { clearSelection(); selectedShape = shape; shape.setEditable(true); } function deleteSelectedShape() { if (selectedShape) { selectedShape.setMap(null); } } function save_coordinates_to_array(newShapeArg) { if(newShapeArg.type == google.maps.drawing.OverlayType.POLYGON) { var polygonBounds = newShapeArg.getPath(); for(var i = 0 ; i < polygonBounds.length ; i++) { coordinates.push(polygonBounds.getAt(i).lat(), polygonBounds.getAt(i).lng()); } } else { //alert("Not polygon");///////////// } } var map; function initialize() { map = new google.maps.Map(document.getElementById('map'), {zoom: 12, center: new google.maps.LatLng(7.07859, 5.64392)}); var drawingManager = new google.maps.drawing.DrawingManager(); drawingManager.setMap(map); google.maps.event.addListener(drawingManager, 'overlaycomplete', function(e) { var newShape = e.overlay; newShape.type = e.type; all_shapes.push(newShape); setSelection(newShape); save_coordinates_to_array(newShape); google.maps.event.addListener(newShape, 'click', function() {setSelection(newShape)}); }); google.maps.event.addListener(map, 'click', function(e) {clearSelection();}); } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <h1>Property identifcation program</h1> <h2> Please Use the Tools shown on the map to markout your parcel location</h2> <div class="map" id="map-canvas"></div> <form method="post" action="" name="informarionForm" id="informarionForm" ><!--onsubmit="save_details(); return false;"--> <p><b></b> <table width="1100" cellpadding="10" cellspacing="0" border="1" align="center"> <tr align="center" valign="top"> <td align="center" colspan="1" rowspan="1" bgcolor="#FF8000"> <table style="width:80%" > <h3>sketch your property location on the Map!!</h3> <tr> Title_holder: <?php $sql =<<<EOF SELECT * from tblperson; EOF; $ret = pg_query($db, $sql); echo'<select name="Title_holder">'; while($row = pg_fetch_assoc($ret)){ echo "<option value=".$row["person_id"].">".$row["first_name"]."</option>"; //print_r($row); } echo '</select>'; ?> </tr> Title_Type: <?php $sql =<<<EOF SELECT * from ownership_type; EOF; $ret = pg_query($db, $sql); echo'<select name="Ownership" id="Ownership">'; while($row = pg_fetch_array($ret)){ $id = $row["type_id"]; if($id == $row["type_id"]){ echo 'selected'; } echo "<option value=".$row["type_id"].">".$row["type_description"]."</option>"; //print_r($row); } echo '</select>'; ?> </tr> <tr> Select boundary identifier: <?php $sql =<<<EOF SELECT * from boundaryidentificationtable; EOF; $ret = pg_query($db, $sql); echo'<select name="boundary_identifier">'; while($row = pg_fetch_array($ret)){ echo "<option value=".$row["boundary_id"].">".$row["boundary_type"]."</option>"; } echo '</select>'; ?> </tr> <tr> Media_Type: <?php $sql =<<<EOF SELECT * from lutmediatypes; EOF; $ret = pg_query($db, $sql); echo'<select name="lutmediatypes">'; while($row = pg_fetch_array($ret)){ echo "<option value=".$row["media_type_id"].">".$row["media_type"]."</option>"; } echo '</select>'; ?> </tr> <p></p> <tr> Select_Media: <?php $sql =<<<EOF SELECT * from tblmedia; EOF; $ret = pg_query($db, $sql); echo'<select name="tblmedia">'; while($row = pg_fetch_array($ret)){ echo "<option value=".$row["media_id"].">".$row["file_name"]."</option>"; } echo '</select>'; ?> <td>Capture boundaryline geometry from Map </td> <td><input name="the_geom2" type="text" id="the_geom2" ></td></td> </tr> <tr> <td>Capture Parcel Geometry from Map </td> <td><input name="the_geom" type="text" id="polygeom" ></td></td> </tr> <tr> <td>Add your description for this parcel:</td> <td><textarea cols="20" name="comments" rows="3" ></textarea></td> </tr> <td> </td> <td> <input name="Submit1" type="button" onclick="save_details();" value="Submit Information." ></td> </tr> </table> <p></p> <table width="700" cellpadding="10" cellspacing="0" border="1"> <tr align="center" valign="top"> <td align="center" colspan="1" rowspan="1" bgcolor="#CCCCCC"> <table style="width: 100%"> <h3>Identify other Useful Land resources and economic trees on your parcel</h3> <tr> Landuse:<?php $sql =<<<EOF SELECT * from landusetable; EOF; $ret = pg_query($db, $sql); echo'<select name="Landuse">'; while($row = pg_fetch_array($ret)){ echo "<option value=".$row["landuse_id"].">".$row["landuse_type"]."</option>"; } echo '</select>'; ?> </tr> <p></p> <tr> <td>Input Resource Name (tree; pond_water):</td> <td><textarea cols="20" name="comments" rows="3" ></textarea></td> </tr> <tr> Select media to upload(video, audio, picture or text): <?php $sql =<<<EOF SELECT * from tblmedia; EOF; $ret = pg_query($db, $sql); echo'<select name="tblmedia">'; while($row = pg_fetch_array($ret)){ echo "<option value=".$row["media_id"].">".$row["file_name"]."</option>"; } echo '</select>'; ?> <tr> <td>Preview Media(video, audio, picture or text)</td> <td><input name="previewVideo" type="text"></td> </tr> <tr> <td> </td> <td> <input name="Submit1" type="button" onclick="save_details();" value="Submit Information." ></td> </tr> </table> </form> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.