shell - How to prevent php of loading a not requested page -
shell - How to prevent php of loading a not requested page -
i had php page executing shellscripts untill added curl process, now, page instead of loading final result (print $output;) loads page of curl request, there way block page of loading , have original behaviour?
this php code:
<?php $thetext = $_post['thetext']; //unify orthography nmt //system("curl --data-urlencode 'contents=$thetext' http://www.chandia.net:8080/nmt"); //new code // curl resource $curl = curl_init(); // set options - passing in useragent here curl_setopt_array($curl, array( curlopt_returntransfer => 1, curlopt_url => 'http://www.chandia.net:8080/nmt', curlopt_useragent => 'codular sample curl request', curlopt_post => 1, curlopt_postfields => array( 'contents' => $thetext ) )); // send request & save response $resp $resp = curl_exec($curl); // close request clear resources curl_close($curl); //tokenize textarea system("cat ../nmt/nmt.txt | /opt/foma/linux64/flookup -i -x -w '' /srv/web/dungupeyem/tokenizer.fst > upfiles/thetext.tok"); //analyze tokenized file system("cat upfiles/thetext.tok | /opt/foma/linux64/flookup -s ' ==> ' -i f -i 1024k /srv/web/dungupeyem/dungupeyem.fst > upfiles/thetext.all"); //prepare text output screen system("grep '==> [^?+]' upfiles/thetext.all > upfiles/thetext.dpy"); system("sed -i 's/$/<br>/g' upfiles/thetext.dpy"); $output = file_get_contents("upfiles/thetext.dpy"); print $output; ?>
thanks in advance
sorry, @mogosselin i've changed code shellscript php function , worked well, right code one:
// curl resource $curl = curl_init(); // set options - passing in useragent here curl_setopt_array($curl, array( curlopt_returntransfer => 1, curlopt_url => 'http://www.chandia.net:8080/nmt', curlopt_useragent => 'codular sample curl request', curlopt_post => 1, curlopt_postfields => array( 'contents' => $thetext ) )); // send request & save response $resp $resp = curl_exec($curl); // close request clear resources curl_close($curl);
php shell curl
Comments
Post a Comment