-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
44 lines (42 loc) · 1.92 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
function url_get_contents ($Url) {
if (!function_exists('curl_init')){
die('CURL is not installed!');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
//$apicallurl = urlencode("http://api2.sinaapp.com/recognize/picture/?appkey=0020120430&appsecert=fa6095e123cd28fd&reqtype=text&keyword=http://luvino.ca/peter.jpg");
//$apicallurl = urlencode("http://api2.sinaapp.com/recognize/picture/?appkey=0020120430&appsecert=fa6095e123cd28fd&reqtype=text&keyword=http://luvino.ca/peter.jpg");
//$apicallurl = "http://api2.sinaapp.com/recognize/picture/?appkey=0020120430&appsecert=fa6095e123cd28fd&reqtype=text&keyword=http://luvino.ca/peter.jpg";
//$apicallurl = "http://www.qr4.nl/QR-API-Dec.aspx?key=dX/POhdGkVd5K4aFhE47jT3X+WiFKssk&Loc=http://luvino.ca/Welcome.png";
//$apicallurl = "http://zxing.org/w/decode?u=http://luvino.ca/images/ohArGju0mtt4p2C5uAoSsrQZd8-0.jpg";
$apicallurl = "http://zxing.org/w/decode?u=http://luvino.ca/images/wikiphoto.jpeg";
$test = url_get_contents($apicallurl);
if ($test == false) {
$contentStr = "The image hasn't been processed yet. Wait few seconds and try again";
}else{
$contentStr = 'good';
}
// $start =strpos($test,'URL was not valid');
// if ($start !== false) {
// $contentStr = "The image hasn't been processed yet. Wait few seconds and try again";
// }else{
// $start =strpos($test,'Raw text</td><td><pre style="margin:0">');
// if ($start !== false) {
// $end =strpos($test,'</pre></td></tr><tr><td>Raw bytes');
// $contentStr = substr($test,$start+39,$end-$start-39);
// }else{
// $contentStr = "QR code in this image is not found";
// }
// }
echo $contentStr;
// include_once("include/QRCodeAPI.class.php");
// $api = new QRCodeAPI();
//$json = $api->decode("images/http-www-good-survey-com.png");
//echo $json
?>