Skip to content

Instantly share code, notes, and snippets.

@calebcgates
Created September 12, 2016 02:18
Show Gist options
  • Save calebcgates/9d433d09d64153f433492293bf171647 to your computer and use it in GitHub Desktop.
Save calebcgates/9d433d09d64153f433492293bf171647 to your computer and use it in GitHub Desktop.
<?php
//http://stackoverflow.com/questions/3080146/post-data-to-a-url-in-php
$url = 'http://www.someurl.com';
$myvars = '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 );
/*
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