You have to use your escape characters correctly. You can’t have a single-quote ('
) inside of a single-quote-encapsulated string. It breaks it. In order to continue the string and have PHP interpret your inner single-quote literally, you have to escape it with \
.
$json_url = file_get_contents('http://maps.google.com/maps/api/geocode/json?address=\'jaipur\'&sensor=false');
Or you can use the alternative string encapsulator, double-quote ("
).
$json_url = file_get_contents("http://maps.google.com/maps/api/geocode/json?address='jaipur'&sensor=false");
For future reference, Parse error: syntax error, unexpected T_STRING
usually means you have a bad string somewhere on that line.
Related Posts:
- PHP parse/syntax errors; and how to solve them
- Best way to parse RSS/Atom feeds with PHP
- Parse (split) a string in C++ using string delimiter (standard C++)
- How to reformat JSON in Notepad++?
- How can I fix MySQL error #1064?
- How to convert code from C# to PHP
- How to parse in C
- How to extract data from a PDF file while keeping track of its structure?
- How to use Stanford Parser in NLTK using Python
- Convert hex color to RGB values in PHP
- Calculate business days
- Replace ' and similar html codes with their correspondent character?
- Google Calendar API event update always return 404 “not found” error
- How to prevent the “Confirm Form Resubmission” dialog?
- navigate back with PHP form submission
- How to set 777 permission on a particular folder? [closed]
- How do I make a redirect in PHP?
- How to use mysqli_query() in PHP?
- How do I make a redirect in PHP?
- List of All Locales and Their Short Codes?
- Parse JSON in JavaScript? [duplicate]
- Difference between “as $key => $value” and “as $value” in PHP foreach
- What is a Context Free Grammar?
- How do I get a YouTube video thumbnail from the YouTube API?
- What is a slug?
- Visual list of all installed fonts with respective pangram phrase?
- How to add elements to an empty array in PHP?
- How to convert/parse from String to char in java?
- How to parse JSON in Java
- What do ++ and *+ mean?
- How to avoid Request Entity Too Large 413 error
- How to log in to phpMyAdmin with WAMP, what is the username and password?
- Array to String PHP?
- How do I get the current date and time in PHP?
- How can I parse JSON with C#?
- What’s the net::ERR_HTTP2_PROTOCOL_ERROR about?
- Undefined function mysql_connect()
- MySQL column count doesn’t match value count at row 1 [closed]
- What is parsing?
- Matching a space in regex
- Undefined function mysql_connect()
- How can I send an email using PHP?
- Fatal error: Call to undefined function mysql_connect()
- Should I use mysqli_real_escape string() or mysql_real_escape_string() for form data?
- count() parameter must be an array or an object that implements countable in laravel
- count(): Parameter must be an array or an object that implements Countable error in php
- Go Back to Previous Page
- How do I check if a string contains a specific word?
- count() parameter must be an array or an object that implements countable in laravel
- How do I replace part of a string in PHP? [duplicate]
- How to declare a global variable in php?
- count(): Parameter must be an array or an object that implements Countable error in php
- Error parsing data org.json.JSONException: Value
- How to fix “Headers already sent” error in PHP
- regex match any whitespace
- How can I split and parse a string in Python?
- How do I parse a string to a float or int?
- How to parse data in JSON format?
- What’s the net::ERR_HTTP2_PROTOCOL_ERROR about?
- How to fix “Headers already sent” error in PHP
- How to pop an alert message box using PHP?
- currently unable to handle this request HTTP ERROR 500
- PHP page redirect
- Fatal error: Call to undefined function mysql_connect()
- “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
- PHP 7.2 – Warning: count(): Parameter must be an array or an object that implements Countable
- How to fix ‘Notice: Undefined index:’ in PHP form action
- Where can I find php.ini?
- Whoops, looks like something went wrong. Laravel 5.0
- PHP “or” Syntax
- PHP “php://input” vs $_POST
- How do I convert a string to a number in PHP?
- Fatal error: Call to undefined function mysql_connect()
- How to fix “Headers already sent” error in PHP
- Loop through an array php
- “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
- What are namespaces?
- Get the full URL in PHP
- What Does This Mean in PHP -> or =>
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- http://localhost:80 is not working on running Apache server through UniServer ZeroXIII
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- PHP header(Location: …): Force URL change in address bar
- PHP – Move a file into a different folder on the server
- phpMyAdmin Error: The mbstring extension is missing. Please check your PHP configuration
- Does PHP supports MVP pattern?
- Mysql query- How to use contains?
- What is Parse/parsing?
- Form submission: PHP S_SESSION statements within a foreach loop
- How do I get PHP errors to display?
- S_SESSION variable (user role) not recognised
- C/C++ JSON parser
- How to validate an email address in PHP
- What are the main differences between PHPExcel and PhpSpreadsheet?
- Is SAJAX dead? What to replace with?
- C++ Parsing input string to variables
- How do I resolve a HTTP 414 “Request URI too long” error?
- Get the full URL in PHP
- How do I check if a string contains a specific word?
- PDOException: SQLSTATE[HY000] [2002] No such file or directory