Checking if a student ID is present in the database
mysql_ is deprecated, and it has been for quite a while. It will be removed in PHP 7, so you should not use it anymore. 
you are open to SQL injection. Never put variables directly into SQL queries, always use prepared statements.
if you use prepared statements, you could prepare your queries only once, and then execute them with multiple different values, which might increase your performance. 
use one connection across your code instead of creating new ones for every query (this can increase your performance).
profile your code to find out what actually causes performance problems. There is no need to "improve" code that is not causing problems. My guess would be that the curl request is the bottleneck, but without profiling, it's hard to say.
return early to reduce your level of nesting. Eg if (!$cond) return false (or throw an exception).
don't just silently fail, as it will be extremely difficult to debug your code this way. You silently fail if the httpcode of your curl request isn't 200, you silently fail if you can't create a database connection, etc.
don't die in functions, it makes it impossible for the calling code to recover. Throw an exception instead. If you do die, at the very least add a message stating the reason for it, as it will otherwise be really hard to debug your code.