Jump to content

Grab external page


Copyleft

Recommended Posts

Hi Everyone,

I'm new and i'm looking for a solution for my problem.

There is an external website (not mine) returning a value after the compilation of a two inputs form. I want to catch the result page!

My purpose is to verify if the external website says "true" or "false" to a request. I have already created something like that for GET results checking every word of the external page in order to find "True" or "false".

How can i do the same thing with a POST request?

 

I tried something and I used curl and this is my function:

function doPost($number) {
$post_data = "&num_tel=023774657";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.siadsl.it/verifica_adsl/copertura_adsl.asp?AR=2" );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);

if (curl_errno($ch)) {
	print curl_error($ch);
}
curl_close($ch);
print $postResult;
}

 

For example i tried with the form of this page: http://www.siadsl.it/verifica_adsl/c..._adsl.asp?AR=2

Why my function doesn't work?

It returns the page with the form not submitted. Why?!

 

Thanks in advance and sorry for my "english" (i'm italian :P )

Link to comment
https://forums.phpfreaks.com/topic/160052-grab-external-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.