I am attempting to write a script that can retrieve the HTML from my school's schedule search webpage. I am able to visit the web page normally when I visit it using a browser, but when I try to get it to work using cURL, it gets the HTML from the redirected page. When I changed the
CURLOPT_FOLLOWLOCATION variable from true to false, it only outputs a blank page with the headers sent.
For reference, my PHP code is
<?php $curl_connection = curl_init('https://www.registrar.usf.edu/ssearch/'); curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, false); curl_setopt($curl_connection, CURLOPT_HEADER, true); curl_setopt($curl_connection, CURLOPT_REFERER, "https://www.registrar.usf.edu/"); $result = curl_exec($curl_connection); print $result; ?> The website that I am trying to get the HTML of from cURL is https://www.registrar.usf.edu/ssearch/ or https://www.registrar.usf.edu/ssearch/search.php
Any ideas?