5 Replies - 440 Views - Last Post: 17 September 2012 - 12:13 PM

#1 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

curL post?

Posted 16 September 2012 - 08:22 PM

I am trying to grab data from a website which uses jQuery behind an expand button (+).
Using Http header, I see it's a POST with a simple URL, with nothing else sent (not that I can see):

http://example.com/abc.jhtml?action=getValue&itemValue=ding&sCode=733-081&time=new%20Date()


So I use curL in php:

$date=date('Y-m-d H:i:s');
$myURL="http://example.com/abc.jhtml?action=getValue&itemValue=ding&sCode=733-081&time=".urlencode($date);
$ch = curl_init();	
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_URL, $myURL);
curl_setopt($ch,CURLOPT_POST, 0);
curl_setopt($ch,CURLOPT_POSTFIELDS, "");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$content=curl_exec($ch);
echo $content;


I end up getting this line:

{"result":{},"status":"fail","code":0,"msg":"server busy, try again!"}

what did I do wrong? anybody can help?
thanks

This post has been edited by Dormilich: 17 September 2012 - 11:59 AM
Reason for edit:: please use example.com or example.org for generic domains


Is This A Good Question/Topic? 0
  • +

Replies To: curL post?

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: curL post?

Posted 17 September 2012 - 03:04 AM

That doesn't look like you've done anything wrong in your PHP but that's just a server response.

What is the code behind on the server?
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6063
  • View blog
  • Posts: 23,515
  • Joined: 23-August 08

Re: curL post?

Posted 17 September 2012 - 03:32 AM

json_decode
Was This Post Helpful? 0
  • +
  • -

#4 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

Re: curL post?

Posted 17 September 2012 - 11:40 AM

View PostRudiVisser, on 17 September 2012 - 03:04 AM, said:

That doesn't look like you've done anything wrong in your PHP but that's just a server response.

What is the code behind on the server?


hmm.. direct access of the url http://example.com/abc.jhtml gives 404, and http://example.com/a...action=getValue gives me the same results {"result":{},"status":"fail","code":0,"msg":"server busy, try again!"} so the info I passed was no better than nothing..

This post has been edited by Dormilich: 17 September 2012 - 11:59 AM
Reason for edit:: please use example.com or example.org for generic domains

Was This Post Helpful? 0
  • +
  • -

#5 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

Re: curL post?

Posted 17 September 2012 - 12:00 PM

never mind. its the cookie that i did not pass.
Was This Post Helpful? 0
  • +
  • -

#6 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: curL post?

Posted 17 September 2012 - 12:13 PM

404 is not the same as a JSON response.

A 404 is triggered (generally) from the server, and the JSON is from the application.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1