0

I am having some problems sending a cURL request with a language (en_US) for example.

1) Could anyone show me an example of how to send a cURL request with US language, and then get the HTML source code.

2) Next, what I am trying to do is to parse some information from the HTML Source code it gave me. What I want to parse looks like this:

http://pastebin.com/05qwEvyj

There are multiple '', so it just has to get 'for each' since it can be a number between 0-5. Next, i want to get the parts where it says 'some text here..' and the 'some url here'.

I hope you can understand me, but to begin with I would just want to send a request with a language. Then we can take number 2 afterwards!

Anders
  • 513
  • 2
  • 10
  • 32
  • Why not use something simpler like `file_get_contents('http://yoursite.com')`? CURL can still do this, but I find the simpler the code is, the easier it is to understand what you're doing later on. – Machavity Nov 09 '13 at 18:22
  • @Machavity - cURL is more advanced, that's why. And what I want to do at first is to send the request with a language. For example en_US. – Anders Nov 09 '13 at 18:31

1 Answers1

0

So, you would like to curl-request a set of pages within a given range? Here is a basic post on using curl in php to 'get' a page:

PHP cURL GET request and request's body

Establish your limits and iterate through the set. Check this posting: Fetching all the images from url

It looks as if, from your pastebin, you are either

1) only grabbing part of the page due to mistargeting (as in you thought you were requesting the entire page but only requested a portion) error

2) grabbing all of what you actually requested which is only a part of page such as a div.

Get some basic request code working (shouldn't take more than a couple of minutes) and if it still doesn't work post the code itself.

Cheers

Community
  • 1
  • 1
Cristian Cavalli
  • 2,619
  • 1
  • 13
  • 11
  • I do have the HTML Source Code, I just want to send the request with a language.. For example en_US (English). – Anders Nov 09 '13 at 18:29
  • mmm http://stackoverflow.com/questions/4212503/how-can-i-set-the-request-header-for-curl the referrer might have the info you need – Cristian Cavalli Nov 09 '13 at 18:45