earni23
09-24-2010, 03:03 PM
Hi
I just read this article (http://particletree.com/features/how-to-add-an-api-to-your-web-service/) which is about making an api with php. The person who wrote it has created a file as follows:
file: api/delete.php
require_once('manage.php');
if(hasPermission($_POST['api_key'])
{
$m = new manage($_POST['entry_id']);
$m->deleteEntry();
}
And when he uses curl, he wrote like this:
$ch = curl_init("http://site.com/api/select");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($ch);
curl_close ($ch);
My question is how does the api know that it should call the delete.php file when he is using select in curl_init(...)?
Shouldn´t it be: $ch = curl_init("http://site.com/api/delete.php");
I just read this article (http://particletree.com/features/how-to-add-an-api-to-your-web-service/) which is about making an api with php. The person who wrote it has created a file as follows:
file: api/delete.php
require_once('manage.php');
if(hasPermission($_POST['api_key'])
{
$m = new manage($_POST['entry_id']);
$m->deleteEntry();
}
And when he uses curl, he wrote like this:
$ch = curl_init("http://site.com/api/select");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($ch);
curl_close ($ch);
My question is how does the api know that it should call the delete.php file when he is using select in curl_init(...)?
Shouldn´t it be: $ch = curl_init("http://site.com/api/delete.php");