QR Code Scanner

БЕЗКОШТОВНО
(Ким) XIEX | Оновлено a month ago | Tools
Health Check

N/A

Повернутися до всіх обговорень

Not working..Url Error

Rapid account: Crimin 4 L
Crimin4L
4 years ago

For some reason this isn’t working, even tho it should be:
I get a URL Error even tho I am encoding the URL like rapid does in the examples:
`<?php
function encodeURL($string) {
$replacements = array(’%21’, ‘%2A’, ‘%27’, ‘%28’, ‘%29’, ‘%3B’, ‘%3A’, ‘%40’, ‘%26’, ‘%3D’, ‘%2B’, ‘%24’, ‘%2C’, ‘%2F’, ‘%3F’, ‘%25’, ‘%23’, ‘%5B’, ‘%5D’);
entities = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "+", "", “,”, “/”, “?”, “%”, “#”, “[”, “]”);
return str_replace($entities, $replacements, $string);
}

if (isset($_GET[‘url’])) {

$eurl = encodeURL($_GET["url"]);
$furl = "https://qr-code-scanner.p.rapidapi.com/qr-code-scan/" . $eurl;
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => $furl,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "x-rapidapi-host: qr-code-scanner.p.rapidapi.com",
        "x-rapidapi-key: <KEY-HERE>"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);

if ($err){
    echo "cURL Error #:" . $err;
}else{
    echo $response . '<br>' . $furl;
} 

}else{
    echo $echoscare;
}

?>`

Thats the php file, and here is a result:
{"code":0,"error":"Url Error."} https://qr-code-scanner.p.rapidapi.com/qr-code-scan/http%253A%252F%252Fqrcode.youlikeshare.com%252Fqrcode_images%252F202008%252F04954a1b5a708ce0f4ffd25ec9d1f8e6_1.png

I am echoing $response + ‘<br>’ + $furl to see the results plus the actual URL it is using, and the URL is perfect but still doesn’t work.

Приєднуйтесь до обговорення — додайте повідомлення нижче:

Вхід / Реєстрація, щоб публікувати нові повідомлення