-1

Trying to post a url to pingdom's web page load testing tool, and grab the resulting html...but, all I get is the home page, as though the post hasn't even gone through. Can anybody see what's going wrong here?

<?php

$ch = curl_init();
$data = array('testurl'="www.google.ca");


curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, "http://tools.pingdom.com/fpt/");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
echo curl_exec($ch);

curl_close($ch);

?>
valen
  • 807
  • 1
  • 16
  • 43

1 Answers1

3

Why would you expect anything else? The home page is all that is there.

If you are trying to get results, you need to look again at how this site works. They are loading results dynamically, with AJAX.

Brad
  • 159,648
  • 54
  • 349
  • 530
  • I see...so...how would I view these results using PHP? I just need the HTML the ajax is returning – valen Jun 13 '12 at 17:48
  • 2
    Download a copy of Fiddler or Wireshark and watch what happens. You'll see a hit to http://browserapi.pingdom.com/api/0.1/test with a few parameters. That's what you want to emulate. – Brad Jun 13 '12 at 17:49
  • Lol I have...I can't figure out the damn API...I only see API for their monitoring tool not for page load test tool – valen Jun 13 '12 at 17:50
  • So posting to browserapi.pingdom.com.api/0.1/test ... how do I know what parameters to pass? – valen Jun 13 '12 at 17:52
  • 2
    @valen, If you can't figure out the two parameters you need (test_id, poll_state_url), then you really shouldn't be attempting this at the moment. Learn to use the tools I suggested, and fully understand how their site works. If you cannot find published API information, it's probably because they don't want you using their API. – Brad Jun 13 '12 at 17:52
  • Where did...you...find those o.O? – valen Jun 13 '12 at 17:53
  • 4
    @valen, Are you even listening to me? How do you think I found them? Oh gee, I don't know, maybe I **used the tools I suggested to you**. – Brad Jun 13 '12 at 17:53
  • @Brad Sorry I mean to say...The whole purpose of hitting their homepage with this request is to obtain the test_id and poll_state_url, so that I can programatically test web pages and view the resulting har files. My question is how to obtain the test_id and poll_state_url – valen Jun 13 '12 at 17:55
  • @valen I tend to say: do your own research. I won't, but I am thinking it. – PeeHaa Jun 13 '12 at 17:56
  • Thanks PeeHaa. I have been...and I will continue to do so. I'm new to curl and APIs in general, so please excuse my ignorance – valen Jun 13 '12 at 17:57
  • 1
    @valen, Are you even listening to me? How do you think I found them? Oh gee, I don't know, maybe I used the tools I suggested to you. – Brad 4 mins ago – PeeHaa Jun 13 '12 at 17:58