php - get hidden input value from page using curl -


I am using curl to display a page response on the thank you page. The code looks like this:

$ curl_handle = curl_init (); Curl_setopt ($ curl_handle, CURLOPT_URL, 'http: //www.site.com'); Curl_exec ($ curl_handle); Curl_close ($ curl_handle);

The page above 'www.site.com' has an hidden input value that looks like this:

& lt; Input type = "hidden" id = "my_id" value = "123" />

I have to take the value ('123') from this hidden input

thanks

= "post-text" itemprop = "text">

you parse HTML You can use to get and get value from the input element. I have not tested this code, but the quick code should look something like this:

  $ doc = new DOMDocument (); $ Doctor & gt; LoadHTMLFile ('http://www.site.com'); $ Id = $ doc- & gt; GetElementById ('my_id') - & gt; GetAttribute ('value'); For example, cnn.com has the following HTML code on the front page.  
  & lt; "US News Headlines Stories and Video"> US & lt; / A & gt;   with "id =" nav-us "href =" / US / "title =" CNN.com " P> The following codes resonate with "US news headlines stories and videos from CNN.com"  
  $ doc = new DOMDocument (); $ Doctor & gt; loadHTMLFile ('http: // www. Cnn.com '); $ title = $ doc-> GetElementById (' Navy-U ') - & gt; getAttribute (' title '); $$ titles;    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -