When I post from a form I have no trouble having action=edit work.
But when I send the same $postdata through a curl script I get: error code="badtoken".
<? $qstr=file_get_contents("php://input");
$url = "http://localhost:8888/hosted/hum211/api.php?action=edit"; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, $qstr); // add POST fields $result = curl_exec($ch); // run the whole process curl_close($ch); echo $result; ?>
To check I tried sending both not to api.php but to some php that would just display the postfilelds. They look exactly alike.
Not sure what to do next.
Timothy S. McKenna Humanities teacher Parkway Academy of Technology and Health, a Boston Public High School 1205 VFW Parkway, Boston, MA 02132 rm404 tim@sitebuilt.net, http://sitebuilt.net exp. course news on twitter, id: mrtmckenna class wiki sites: http://pathboston.com/hum3 Humanities 3 http://pathboston.com/hum2 Humanities 2 (617) 942-0103