0

I found this website http://www.fonefinder.net/findome.php , that locates phone provider by number (ex: http://www.fonefinder.net/findome.php?npa=562&nxx=866&thoublock=1666) shows VERIZON CALIFORNIA INC.-CA (GTE) . I am trying to get result using linux curl and through php curl but receive "You must input more numeric digits." like no data is sent. I tried below methods and they do not work. What is wrong and how can i get results?

curl --data "npa=562&nxx=866&thoublock=1666&usaquerytype"  \
     link --header "Content-Type:text/html"

also tried x-www-form and with this script:

<?
//extract data from the post
extract($_POST);

//set POST variables
$url = 'link';
$fields = array('npa' => urlencode(544), );

//url-ify the data for the POST
foreach($fields as $key=>$value) { 
   $fields_string .= $key.'='.$value.'&'; 
}
rtrim($fields_string, '&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

//execute post
$result = curl_exec($ch);
echo "$result";
//close connection
curl_close($ch);
?>

All methods result in "You must input more numeric digits."

  • Why POST? Their form appears to use GET. – Lars Rohrbach Jul 4 '15 at 0:06
1

Your request uses the GET method, which means the query is encoded into the URI.

See here for more info http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9

So you need to generate and append the query string to the url e.g. findome.php?npa=562&nxx=866 ...

<?php
$url = "http://www.fonefinder.net/findome.php";
$query = array('npa'=>562,'nxx'=>866,'thoublock'=>1666,'usaquerytype');
$url .= sprintf("?%s", http_build_query($query, '', '&'));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
echo "$result";
?>
  • Terse answers such as the above are very much frowned upon on the StackExchange sites. Please take the time to explain what you have suggested in some details, and why your suggested snippet of code will solve the problem in uqestion, so that even users less fluent in php may benefit from your post. – MariusMatutiae Jul 4 '15 at 7:06
  • This works , thank you . I need this to make a script that checks 1000 or more phone numbers and to save results for each number the provider , it's hard on browser to test 1 phone number at a time but with Linux and php-curl its easy to test as many numbers you want . ex: 562-866-1666 - California | Verizon . (but for this the script needs to be modified to take the phone numbers from a list and split phone number with awk to erase "-" from number and to put 3 args for 'npa' => "$argv[1]" 'nxx'=> "$argv[2]" 'thoublock'=>"$argv[2]" . i will post the full script after is done – harold drake Jul 4 '15 at 16:27
0

(I formatted you message a little to make it more readable.)

If you do the above, you get the same error message in a browser too, so it's not cURL's fault.

I wonder where you found the format? If you do it manually, then the query is just a normal GET:

http://www.spokeo.com/reverse-phone-lookup/search?p=1234567890&sea2=t104

where 123456790 is a 10-digit phone number. I suspect sea2 to be a session identifier, which you get from the previous page.

EDIT: It's a little different. The request is even easier:

GET /search?q=1234567890

This gives an error 302 (relocation) which your progam must process and do a GET to the first URL I passed.

  • This was my problem POST GET , i dont know php so well . the original page with the form is this fonefinder.net – harold drake Jul 4 '15 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.