Note that there are some explanatory texts on larger screens.

plurals
  1. POcurl - go to second page with query string
    primarykey
    data
    text
    <p>I need to use curl to login at a form and then get the second page. I have this:</p> <pre><code>function http_post($url, $post, $url2, $post2) { $referer = "hp://www.jall.xxx.xxx/menu.do"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0"); curl_setopt($ch,CURLOPT_COOKIESESSION,false); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, $referer); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'my_cookies.txt'); curl_setopt ($ch, CURLOPT_POSTFIELDS, $post); curl_setopt ($ch, CURLOPT_POST, 1); curl_exec($ch); curl_setopt ($ch, CURLOPT_URL, $url2); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $test = curl_exec($ch); curl_close($ch); return $test; } $data = array('l_username' =&gt; 'MY_LOGIN', 'l_password' =&gt; 'MY_PASSWORD'); $data2 = array('seleciona' =&gt; '2', 'num' =&gt; '123456'); echo http_post('http://www.jall.xxx.xxx/menu.do', http_build_query($data), 'http://www.jall.xxx.xxx/pesquisa_pesquisa.do', $data2); </code></pre> <p>If i use the second url like this ( hxxp://www.jall.xxx.xxx/pesquisa_pesquisa.do ) the return is ok, but i need to access this second page: hxxp://www.jall.xxx.xxx/pesquisa_pesquisa.do?seleciona=2&amp;num=123456 with query string and when i use query string i get error.</p> <p>1 - login: hxxp://www.jall.xxx.xxx/web/menu.do</p> <p>2 - get source code: hxxp://www.jall.xxx.xxx/pesquisa_pesquisa.do?seleciona=2&amp;num=123456</p> <hr> <p>If I use curl to access restricted pages that don't need query string the result is ok but when I try to access page that need query string the error is: you need to login to see this page.</p> <p>1 - The first form (login) is POST</p> <p>2 - The second form is GET</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload