Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7870587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:39:46+00:00 2026-06-03T01:39:46+00:00

<?php in this part I provide a latitude a longitude to reverse geocode. $ch

  • 0
 <?php

in this part I provide a latitude a longitude to reverse geocode.

 $ch = curl_init("http://maps.google.com/maps/api/geocode/json?latlng=39.784268,-98.393555&sensor=false");

 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
 $return = curl_exec($ch);
 curl_close($ch);
 $geoOutput = json_decode($return, true);

 $data = current($geoOutput);
 echo $data; 

After that I want to pass the content to a servlet but for example purposes I embedded the street and zipcode.
The generated url is like the following, but if you run the url will not happen anything in curl. But if you copy paste the code in the browser will succed.

  $urlse="http://136.145.116.30:8080/AccidentDetailsInserter?latitude=18.209&longitude=-67.139&frontal_damage=1&left_damage=1&right_damage=0&back_damage=0&smoke_detected=0&flipped=0&maxforce=7&roll=0&pitch=0&yaw=0&device_id=47&street=Calle Caobos&city= Mayagüez&state=PR&zip= 00680";

echo $urlse;

     $ch = curl_init();
      $timeout = 5;
      curl_setopt($ch,CURLOPT_URL,$urlse);
      curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
      curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
      $data = curl_exec($ch);
      curl_close($ch);
      echo $data;

here the output is blank

    ?>

I tried to write to specify the port to 8080 but nothing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:39:47+00:00Added an answer on June 3, 2026 at 1:39 am

    Your second URL contains spaces and other unescaped characters that should be urlencoded. If you paste it in the browser the browser fixes that for you. CURL doesn’t.

    instead of street=Calle Caobos or other such parameters, you should send street=Calle%20Caobos. just use urlencode() on all parameters you are building.

    Edit: there were a few things missing here, here is some working code:

    $urlse="http://136.145.116.30/AccidentDetailsInserter?latitude=18.209&longitude=-67.139&frontal_damage=1&left_damage=1&right_damage=0&back_damage=0&smoke_detected=0&flipped=0&maxforce=7&roll=0&pitch=1&yaw=0&device_id=47&street=CalleCaobos&city=SanJuan&state=PR&zip=00926";
    echo $urlse;
    
         $ch = curl_init();
          $timeout = 10;
          curl_setopt($ch,CURLOPT_URL,$urlse);
          curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
          curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
          curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
          curl_setopt($ch, CURLOPT_PORT, 8080);
          $data = curl_exec($ch);
          curl_close($ch);
          echo $data;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this code to send mail with php http://www.siteduzero.com/tutoriel-3-35146-e-mail-envoyer-un-e-mail-en-php.html#ss_part_4 . This code
I have this part of code in my functions.php: function cc_admin_enqueue_scripts($hook) { $file_dir=get_bloginfo('template_directory'); wp_enqueue_script('media-upload');
I need a fix for this. here is just part of my code <?php
In php this is how you would check if a file is selected: $_FILES['item']['size']>0
I have the following code: if (include_once(dirname(__FILE__).'/file.php') || include_once(dirname(__FILE__).'/local/file.php') ) { This causes an
I has Status Model <?php /** * This is the model class for table
PHP lists this example as a way to retrieve database data. <?php $return =
php -v gives this PHP Warning: PHP Startup: memcache: Unable to initialize module Module
I found this PHP code in an app I have to modify... $links =
I asked this over on Google's support forums for Apps integration, but got zero

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.