Created
September 12, 2016 02:45
-
-
Save calebcgates/63932266898a5d2bef086a6b431c6fce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//http://stackoverflow.com/questions/3080146/post-data-to-a-url-in-php | |
$url = 'http://phonebook.uconn.edu/results.php'; | |
// status => any | |
// basictext => (30 char limit) > this is a name | |
$status = 'any'; | |
$basictext = 'Caleb Gates'; | |
$myvars = 'status='.$status.'&basictext='+$basictext; //= 'myvar1=' . $myvar1 . '&myvar2=' . $myvar2; | |
$ch = curl_init( $url ); | |
curl_setopt( $ch, CURLOPT_POST, 1); | |
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars); | |
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt( $ch, CURLOPT_HEADER, 0); | |
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); | |
$response = curl_exec( $ch ); | |
echo $response; | |
/* | |
phonebook, post variables: basictext, and status (student,faculty) to results.php < probably returns json object names, and emails | |
-- can also explore advanced search | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment