php - curl 403 forbidden -
php - curl 403 forbidden -
i getting 'you don't have permission access /rest/02/put.php on server.' message while using following.
this put-service-consumer.php
<?php $url = 'http://127.0.0.1/rest/02/put.php'; $fh = fopen('data.txt', 'r'); $data = file_get_contents('data.txt'); $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_infile, $fh); curl_setopt($ch, curlopt_infilesize, strlen($data)); curl_setopt($ch, curlopt_put, true); curl_exec($ch); curl_close($ch); ?>
this put-service.php
<?php $putdata = fopen("php://input", "r"); echo $putdata."here"; $fp = fopen("put_data_file.txt", "a"); while ($data = fread($putdata, 1024)) fwrite($fp, $data); fclose($fp); fclose($putdata); ?>
this illustration restful php webservice book. while examples , post works, examples delete , set isn't working. help in advance.
this may aid in debugging: https://chrome.google.com/webstore/detail/faceofpmfclkengnkgkgjkcibdbhemoc
that's great tool utilize work rest apis.
php codeigniter rest curl
Comments
Post a Comment