0

My curl request is..

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
//curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_INTERFACE,$proxy);
curl_setopt($ch,CURLOPT_PORT, '8888');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); 
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
pr($ch);
$result = curl_exec($ch);
curl_close($ch);
echo $result;

Error Resource id #12 i am trying to fetch data from amazon and have a list of ip address, and port number. sending request from diff port number preventing blocking from amazon...

aynber
  • 22,380
  • 8
  • 50
  • 63
  • What's the values of $url and $proxy? What is the output of curl_error()? – Benjamin Jan 06 '17 at 09:51
  • $URL="https://www.amazon.com/s/?page=1&field-keywords=books+&rh=n%3A283155%2Ck%3A=books&lo=strips&low-price=10&high-price=20000&ref=s9_acss_bw_en_BGG15eve_d_1_2?_encoding=UTF8&node=2&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=merchandised-search-top-3&pf_rd_r=MP3N7TX4MQHGDQFDHH4V&pf_rd_r=MP3N7TX4MQHGDQFDHH4V&pf_rd_t=101&pf_rd_p=593f03ec-42c4-42a6-9137-4fbc35330991&pf_rd_p=593f03ec-42c4-42a6-9137-4fbc35330991&pf_rd_i=283155" – Muhammad Awais Zulifqar Jan 06 '17 at 10:12
  • and proxy is 108.62.150.134 tell me whats the solution?? – Muhammad Awais Zulifqar Jan 06 '17 at 10:13

3 Answers3

2

It seems that your curl client is getting some response from server that it can not understand, Error#12 means: CURLE_FTP_WEIRD_USER_REPLY

here is the PHP Manual link: http://php.net/manual/en/function.curl-errno.php

and description of error: http://web.mit.edu/jhawk/mnt/ss.b/curl-7.10.5/docs/libcurl/libcurl-errors.html

You can use curl_error to capture the error How to catch curl errors in PHP

Other thing to consider here is your proxy, is it allowed to access the host and port you are trying to access and you access the host without proxy?

Community
  • 1
  • 1
Ravish
  • 2,383
  • 4
  • 37
  • 55
  • any solution?? need your help?? – Muhammad Awais Zulifqar Jan 06 '17 at 11:32
  • did you try connecting to host directly? is there any IP restriction on host you are trying to connect ? – Ravish Jan 06 '17 at 11:50
  • I'm scraping amazon, and when first did scraping i did't know that more than one requests in second block your IP address, in my case request more than 20 times and amazon block my IP address and show Robot Check, impossible to skip it – Muhammad Awais Zulifqar Jan 06 '17 at 11:52
  • trying adding a delay, if you are making frequent hits, they'll block your IP for sure – Ravish Jan 06 '17 at 13:32
  • 1
    have a look at this article, it's old, but still relevant : http://ghostproxies.com/blog/2015/09/7-things-to-know-before-scraping-amazon-product-results/ – Ravish Jan 06 '17 at 13:39
  • Things are now out of control, had enough of it, now how to skip Robot Check, read the article already, but need solution... Im searching to solve this problem for last 12 hours but did't fine any solution... :( – Muhammad Awais Zulifqar Jan 06 '17 at 13:54
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/132501/discussion-between-muhammad-awais-zulifqar-and-ravish). – Muhammad Awais Zulifqar Jan 06 '17 at 13:57
2
CURLE_FTP_WEIRD_SERVER_REPLY (8)

The server sent data libcurl couldn't parse. This error code is used for more than just FTP and is aliased as CURLE_WEIRD_SERVER_REPLY since 7.51.0.

CURLE_REMOTE_ACCESS_DENIED (9)

We were denied access to the resource given in the URL. For FTP, this occurs while trying to change to the remote directory.

CURLE_FTP_ACCEPT_FAILED (10)

While waiting for the server to connect back when an active FTP session is used, an error code was sent over the control connection or similar.

CURLE_FTP_WEIRD_PASS_REPLY (11)

After having sent the FTP password to the server, libcurl expects a proper reply. This error code indicates that an unexpected code was returned.

CURLE_FTP_ACCEPT_TIMEOUT (12)

During an active FTP session while waiting for the server to connect, the CURLOPT_ACCEPTTIMEOUT_MS (or the internal default) timeout expired.

for more details enter link description here

Gaurav Rai
  • 900
  • 10
  • 23
1

CURLE_FTP_ACCEPT_TIMEOUT (12)

During an active FTP session while waiting for the server to connect, the CURLOPT_ACCEPTTIMEOUT_MS (or the internal default) timeout expired.

HaiderAli
  • 21
  • 7