Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 29th, 2012  |  syntax: PHP  |  size: 1.30 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. ob_start();
  3. //create array of data to be posted
  4. $post_data['wu_loginname'] = '------';
  5. $post_data['wu_password'] = '------';
  6.  
  7. foreach ( $post_data as $key => $value) {
  8.     $post_items[] = $key . '=' . $value;
  9. }
  10. //create the final string to be posted using implode()
  11. $post_string = implode ('&', $post_items);
  12. //create cURL connection
  13. $curl_connection =
  14.   curl_init('http://leerlingen.lauwerscollege.nl/Page/nctrue/sp17/restyle/action=login/Index.html');
  15. //set options
  16. curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
  17. curl_setopt($curl_connection, CURLOPT_USERAGENT,
  18.   "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
  19. curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
  20. curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
  21. curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
  22. //set data to be posted
  23. curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
  24. //perform our request
  25. $result = curl_exec($curl_connection);
  26. //show information regarding the request
  27. print_r(curl_getinfo($curl_connection));
  28. echo curl_errno($curl_connection) . '-' .
  29.                 curl_error($curl_connection);
  30. //close the connection
  31. curl_close($curl_connection);
  32. header('Location: http://leerlingen.lauwerscollege.nl/Page/nctrue/sp17/restyle/action=login/Index.html');
  33. ?>