Copyleft Posted May 28, 2009 Share Posted May 28, 2009 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 ) Quote Link to comment https://forums.phpfreaks.com/topic/160052-grab-external-page/ Share on other sites More sharing options...
RussellReal Posted May 28, 2009 Share Posted May 28, 2009 that looks like it should work =\, are you CALLING the function? Quote Link to comment https://forums.phpfreaks.com/topic/160052-grab-external-page/#findComment-844410 Share on other sites More sharing options...
corbin Posted May 28, 2009 Share Posted May 28, 2009 $post_data = "&num_tel=023774657"; The format of POST data is: var1=val1&var2=val2&varx=valx So why are you prefixing it with an &? Quote Link to comment https://forums.phpfreaks.com/topic/160052-grab-external-page/#findComment-844413 Share on other sites More sharing options...
Copyleft Posted May 28, 2009 Author Share Posted May 28, 2009 $post_data = "&num_tel=023774657"; The format of POST data is: var1=val1&var2=val2&varx=valx So why are you prefixing it with an &? Same result with $post_data = "num_tel=023774657"; ??? Quote Link to comment https://forums.phpfreaks.com/topic/160052-grab-external-page/#findComment-844419 Share on other sites More sharing options...
Copyleft Posted May 29, 2009 Author Share Posted May 29, 2009 up ??? Quote Link to comment https://forums.phpfreaks.com/topic/160052-grab-external-page/#findComment-844971 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.