Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.