T_STRING error in my php code

165 views Asked by At

I have this PHP that is supposed to crawl End Clothing website for product IDs

When I run it its gives me this error

Parse error: syntax error, unexpected 'i' (T_STRING), expecting '(' in C:\xampp\phpMyAdmin\end3.php on line 5

<?php
#!/bin/bash
#Crawl End Clothing For Product IDs

for i in $(eval echo {$1..$2})
do
rm -f end-cookie.jar
curl -c end-cookie.jar -L 
http://www.endclothing.co.uk/checkout/cart/add/uenc/aHR0cDovL3d3dy5lbmRjbG90aGluZy5jby51ay9ldHEtaGlnaC10b3AtMS1zbmVha2VyLWVuZC1leGNsdXNpdmUtZXRxLTQtZW5kYmsuaHRtbA,,/product/253361/form_key/DcwmUqDsjy4Wj4Az/ 

-s -o /dev/null
url='curl -b end-cookie.jar -w "%{url_effective}\n" -L -s -S -o 

/dev/null 
http://www.endclothing.co.uk/checkout/cart/add/uenc/aHR0cDovL3d3dy5lbmRjbG90aGluZy5jby51ay9ldHEtaGlnaC10b3AtMS1zbmVha2VyLWVuZC1leGNsdXNpdmUtZXRxLTQtZW5kYmsuaHRtbA,,/product/

$i/form_key/DcwmUqDsjy4Wj4Az/ 
'
echo $i - $url
done
?>

How do I fix this please? Thanks

1

There are 1 answers

3
Jjsg08 On BEST ANSWER

I think that you get this code of C# or C++ or other similar language, this code not work in PHP,

If you get an external java application (jar) use the exec functions instead.

$url_effective = "http://www.endclothing.co.uk/checkout/cart/add/uenc/aHR0cDovL3d3dy5lbmRjbG90aGluZy5jby51ay9ldHEtaGlnaC10b3AtMS1zbmVha2VyLWVuZC1leGNsdXNpdmUtZXRxLTQtZW5kYmsuaHRtbA,,/product/$i/form_key/DcwmUqDsjy4Wj4Az/";
$crwal = exec("end-cookie.jar -w".$url_effective." -L -s -S -o");

Or some for this style.