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

  • Home
  • SEARCH
  • 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 4582500
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:05:01+00:00 2026-05-21T21:05:01+00:00

I am currently facing a problem that is concerning the google search, curl and

  • 0

I am currently facing a problem that is concerning the google search, curl and json.

First of all I would like to show you the code I already have:
http://pastebin.com/LZzDZvHC

Let me explain some stuff about it:

  • I am not showing the key that I received from google
  • $data is the Post I am getting from the submitted form
  • ip is the user ip
  • $url is obviously the ajax request url from googleapps

so if I print out the $url and put it into my browser I get a nice JSON back – works perfectly. I suppose you can already guess what the problem is.

After those declarations I am starting the curl.

I get something back and want to convert the json to an array.

SO here is the problem:
I dont get JSON back I get an error back.

Saying:

400. That’s an error.
Your client has issued a malformed or illegal request. That’s all we know.

With a nice google logo on top of it.

So I tried to put a user agent into my curl request -> does not work as well.

Dont worry about my json_decode() – I did install and test it and it is working fine! SO there is no problem there.

As I get this error message I obviously get a “NULL” from the var_dump();

IF I dont set [assoc] to true my browser is not even showing my website.
(http://www.php.net/manual/en/function.json-decode.php)

Now please have a look at the docu from google:
http://code.google.com/apis/websearch/docs/
scroll down to Php Access

I could imagine that this is not only a problem with the search but also with other google services as it seems to me like a restriction as my curl request comes from a server.

I hope somebody has an idea how to overcome that problem because I would like to use it.

  • 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-05-21T21:05:01+00:00Added an answer on May 21, 2026 at 9:05 pm

    What’s the output of print $url;? Does that look right? You might need to urlencode the paramter values…

    I see a nice JSON response when I open https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=oele&key=boele&userip=12.34.6.78

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, I am writing up a bit of a product-based CMS as my first
Currently, I am developing a product that does fairly intensive calculations using MS SQL
Greetings! This is my first question. I've searched all over the web as well
I'm facing some issues with a rapidly growing table at increasing speed (currently 4mio
I have Java code that works on my desk top...its a simple app that
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and
Currently my workflow with Emacs when I am coding in C or C++ involves
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
Currently we have a project with a standard subversion repository layout of: ./trunk ./branches
Currently I'm doing some unit tests which are executed from bash. Unit tests are

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.