-2

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

Hasan Qusay
  • 81
  • 1
  • 7

1 Answers1

0

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.

Jjsg08
  • 124
  • 11
  • yes I got it from an outside source and wasnt sure. I tried your advice and still gives me an error about line 5 :( – Hasan Qusay Jun 16 '15 at 02:56
  • in php for bucle should be: `for($i=0;$i <= $total_ids ; ++$i){ `. `$total_ids` is a fake variable, you should find a way to know the total of the data to run the for bucle, then put this in one variable. – Jjsg08 Jun 16 '15 at 03:15
  • This question can be very useful for your pourpose http://stackoverflow.com/questions/2313107/how-do-i-make-a-simple-crawler-in-php?rq=1 – Jjsg08 Jun 16 '15 at 04:32